Android Studio 3.2 Canary 14:以下软件包不可用 "Package id platforms;android-28"

Android Studio 3.2 Canary 14: The following packages are not available "Package id platforms;android-28"

刚刚安装了新的 Android Studio 3.2 Canary 14 build clean config 来试用新的 AndroidX。创建新项目后,转到 Refactor -> Refactor to AndroidX,Studio 要求将 compileSdkVersion 升级到 28。在 build.gradle 中进行升级得到 Install missing platform tools 然后错误:The following packages are not available "Package id platforms;android-28" SDK Manager 说 Platform P 已部分安装(没有源代码包)。更新通道设置为 Canary,尝试完全重新下载 SDK - 没有帮助。使用 Mac OS High Sierra 10.13.4

这里是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'
}

这是我的 SDK 管理器 window: SDK Manager Screenshot

这是我的 Android Studio 构建信息:Update channel and AS build Screenshot

提前感谢您的帮助!

要全面测试您的应用与 Android P 的兼容性并开始使用新的 API,请打开您的模块级 build.gradle 文件并更新 compileSdkVersion 和 targetSdkVersion,如下所示:

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

    defaultConfig {
        targetSdkVersion 'P'
    }
    ...
}

请阅读Set Up the Android P SDK了解更多信息