安卓工作室 3.2 金丝雀 14 : The following packages are not available "Package id platforms;android-28"

标签 android android-studio android-studio-3.2

刚刚使用clean config 安装了新的 Android Studio 3.2 Canary 14 版本来试用新的 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 管理器说 Platform P 已部分安装(没有源代码包)。更新 channel 设置为 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 管理器窗口: 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了解更多信息

关于安卓工作室 3.2 金丝雀 14 : The following packages are not available "Package id platforms;android-28",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50385442/

相关文章:

android - 构建失败的未知属性 'packagingOptions'

android - 防止旋转动画在取消时重置

java - 从用户位置查找数组中最近的经度和纬度 - Android Studio

android-studio - 是否有在两个不同的 android studio 实例之间切换的捷径

unit-testing - Android Studio 3.2测试配置不起作用

java - Android Webview 应用程序中的 Youtube/视频播放

android - 使用 Intent 过滤器从 URL 打开 Android 应用程序不起作用

java - 小米和oppo等中国ROM上的工作管理器,在电池优化时,将工作的计划延迟增加几个小时

android - 如何在 Android Studio 中显示隐藏文件