Reputation: 328
I'm trying to refactor my code to androidX. To do so android asked me to update the compiled version to at lease 28. So I changed my compiled version to compileSdkVersion 28
in bulid.gradle
.
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 17
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
But once I sync project I'm unable to download the platform plugins and the following error shows up in build window.
Failed to find target with hash string 'android-28' in: /Users/work/Library/Android/sdk
Upvotes: 2
Views: 970
Reputation: 12005
Your compile version should be android-p. They're using the version name now.
compileSdkVersion 'android-P'
And target should be just P
targetSdkVersion 'P'
See here to know how to set up Android P SDK.
Edit:
If your getting an error/warning "minSdkVersion (21) is greater than targetSdkVersion (1)" this is done on purpose, see here.
As Android P is still Preview, the 'P' in the targetSdkVersion will work as a version 1. Once it's out of preview it will be replaced with the usual 28. For now, to fix this you'd need to raise the minSdkVersion to also 'P'.
Upvotes: 2