Failed to find target with hash string 'androi

2020-04-18 05:29发布

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.

sdk manager

any idea? thanks

2条回答
爷的心禁止访问
2楼-- · 2020-04-18 06:06

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.)

enter image description here

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

查看更多
家丑人穷心不美
3楼-- · 2020-04-18 06:32

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!

查看更多
登录 后发表回答