我正要将支持SDK更新到Android的最新版本,即SDK 31 "S“,但它与Gradle sync有一些问题。
错误
Failed to notify build listener.
Could not resolve all dependencies for configuration ':app:debugRuntimeClasspath'.
Could not create task ':app:minifyDebugWithR8'.
Cannot query the value of this provider because it has no value available.
Failed to stop service 'com.android.build.gradle.internal.errors.SyncIssueReporterImpl$GlobalSyncIssueService_5d47b2c0-a1a4-43ab-bbdb-bb6abdacb3ba'.
Failed to find Platform SDK with path: platforms;android-31这就是设置
compileSdk 31
defaultConfig {
applicationId "com.app.app
minSdk 21
targetSdk 31
versionCode 7
versionName "1.0.9"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}已在使用最新的AGP com.android.tools.build:gradle:7.1.0-alpha01
已经安装了Android "S“预览工具。

最后已经有了最新的AS版本预览
Android Studio Bumblebee | 2021.1.1 Canary 1 Build #AI-203.7717.56.2111.7361063,创建于2021年5月14日
documentation无法正常工作。
No signature of method: build_cdzmabn9imuzupf8f433s2vnq.android() is applicable for argument types: (build_cdzmabn9imuzupf8f433s2vnq$_run_closure1) values: [build_cdzmabn9imuzupf8f433s2vnq$_run_closure1@6f573027]Gradle同步是成功的
compileSdkPreview "android-S"
targetSdkPreview "S"但该应用程序根本无法在任何设备上安装,无论是发行版还是调试版。
我们还能做什么呢?
发布于 2021-05-29 04:37:41
你应该仔细阅读谷歌提供的迁移文档:https://developer.android.com/about/versions/12/migration
谷歌通常不希望你在开发工具包达到平台稳定性之前在生产环境中更新你的targetSdkVersion (参见时间线here),而是在本地测试它。一旦最新的API最终敲定,他们预计大多数应用程序都会更新targetSdkVersion,以表明他们证明该应用程序与给定的SDK级别兼容。最近,谷歌开始实施长达一年的宽限期,然后他们才开始强制所有新应用程序都应该针对最新的SDK。
发布于 2021-10-28 03:44:20
将compileSdk和targetSdk版本从31降低到30解决了我的问题。不建议这样做。但在紧急情况下使用它。
https://stackoverflow.com/questions/67649546
复制相似问题