1

Just installed new Android Studio 3.2 Canary 14 build with clean config to try out new AndroidX. After creating new project going to Refactor -> Refactor to AndroidX and Studio asks to upgrade compileSdkVersion to 28. Doing the upgrade in build.gradle got Install missing platform tools and then error: The following packages are not available "Package id platforms;android-28" SDK Manager says that Platform P is partially installed (no source-code package). Update channel set to Canary, tried to completely redownload SDK - did not help. Using Mac OS High Sierra 10.13.4

Here is build.gradle:

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "my.app.id"
        minSdkVersion 21
        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'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:28.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

Here is my SDK Manager window: SDK Manager Screenshot

Here is my Android Studio build info: Update channel and AS build Screenshot

Thank you for help in advance!

Imajou
  • 13
  • 1
  • 5

1 Answers1

4

To fully test your app's compatibility with Android P and begin using new APIs, open your module-level build.gradle file and update the compileSdkVersion and targetSdkVersion as shown here:

android {
    // sdk version 28
    compileSdkVersion 'android-P' 

    defaultConfig {
        targetSdkVersion 'P'
    }
    ...
}

Please read Set Up the Android P SDK for further information

phatnhse
  • 3,870
  • 2
  • 20
  • 29
  • That helped, thank you! Also should be `minSdkVersion 'P'` – Imajou May 17 '18 at 07:37
  • in case you want to support devices version android P and above @Imajou. For more about version distribution, take a look at this https://developer.android.com/about/dashboards – phatnhse Feb 15 '20 at 05:09