Failed to find target with hash string 'android-P' Install missing platform(s) and sync project

时间秒杀一切 提交于 2019-12-04 05:26:15

问题


Following this android tutorial https://codelabs.developers.google.com/codelabs/mdc-101-java/#1 I'm trying to setup android-p in android studio 3.2 canary version.

I have downloaded the following project from github to test material design https://github.com/material-components/material-components-android-codelabs but I get an error when gradle build runs (Failed to find target with hash string 'android-P' Install missing platform(s) and sync project)

When I look in the sdk manager I see Android P is installed but gradle is not recognizing it.

any idea? thanks


回答1:


It's not a problem of the target platform that you are using, the problem is most probably related to the current situation about Google artifacts from the Google Maven repository, as you can see here.

Long story short, Google repository contained incorrect checksums for certain artifacts. JFrog Bintray stopped bringing files over from Google repository, and having in consideration they were mirroring Google's repositories, it all messed up.

The easiest solution for now is just switching the order of the repositories sites, so if you have: jcenter() google() just change it by: google() jcenter()

If you want to know more about why JFrog Bintray is mirroring those Google repos, don't ask, because anyone knows, ha!

Result: Hundreds of thousands of repositories corrupted/broken due to this problem.

There's been some ragging threads about it, you can check some of them here, here or here

Good luck!




回答2:


There is a newer Android API 28 SDK Platform you should download and use (it looks like you have this downloaded already based on your screenshot.)

Then, specify 28 in your build file for your targetSdkVersion instead of 'android-P'.



来源:https://stackoverflow.com/questions/50826588/failed-to-find-target-with-hash-string-android-p-install-missing-platforms-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!