问题
I'm following this tutorial page
and i get the exact same error that they say in that page
Failed to find target with hash string 'android-P' in: D:\Development\Android\Sdk Install missing platform(s) and sync project
when i click
install missing platform(s) and sync project it shows the error as
All packages are not available for download! The following packages are not available:
- Package id platforms;android-P
I have installed almost all the SDK it asks for ANDROID - P.
回答1:
you're trying to find a SDK that corresponds to the version "android-p".
Have a look at your build.gradle file:
android {
compileSDKVersion 'android-p'
..........
}
change it to
android {
compileSDKVersion 28
..........
}
note that the version 28 is just one example, you could be using any version.
that should do the job for you.
回答2:
It looks like issue is ralated to checksums in repositories. Take a look at this answear: https://stackoverflow.com/a/50842352
回答3:
I followed the answer of Bevilaqua
Then, a dialog poped to make a Gradle Plugin Update : Android Gradle Plugin Update Required
Of course, it failed : enter image description here
So, to fix it, I manually installed a recent version of Gradle from enter link description here in my .gradle folder (in Windows C:\Users\...\.gradle\wrapper\dists\
)
And I got another problem because a these line in styles.xml :
<style name="Widget.Shrine.TextInputLayout" parent="Widget.MaterialComponents.TextInputLayout.OutlineBox">
where I replaced OutlineBox by OutlinedBox :
<style name="Widget.Shrine.TextInputLayout" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox">
(Source)
Now, everything is functional.
来源:https://stackoverflow.com/questions/50841660/failed-to-find-target-with-hash-string-android-p