我将我的 SDK 版本更新为最新的 API 级别 30 (R),即所谓的 Android 11。现在,它在 Android R 模拟器中完美运行,但是当我尝试在棉花糖版本上运行时,它给出了以下异常。我试图删除所有 SDK 和清理/重建项目,使缓存/重启无效。
**Exception:**
Installation did not succeed.
The application could not be installed: INSTALL_FAILED_OLDER_SDK
The application's minSdkVersion is newer than the device API level.
它只适用于 Android R。我该怎么办?
android {
compileSdkVersion 'android-R'
defaultConfig {
applicationId "com.lifetrenz.lifetrenz_gcc_doctorapp"
minSdkVersion 21
targetSdkVersion 'R'
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
我想测试从 API 21 到 API R 的应用程序
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.1.0'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
//Lifecycle components
def life_versions = "2.2.0-beta01"
implementation "android.arch.lifecycle:extensions:$life_versions"
annotationProcessor "android.arch.lifecycle:compiler:$life_versions"
//Server API Integration
implementation 'com.squareup.retrofit2:retrofit:2.7.1'
implementation 'com.squareup.retrofit2:converter-gson:2.7.1'
implementation "com.squareup.okhttp3:logging-interceptor:4.4.0"
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.7.1'
//For QR Scanner
implementation 'com.google.android.gms:play-services-vision:19.0.0'
}
根据开发者预览网站:
Android 11 开发者预览版适用于 Google Pixel 4 / 4XL、Pixel 3a / 3a XL、Pixel 3 / 3 XL 和 Pixel 2 / 2 XL。
就目前而言,您只能在上述物理设备上运行和测试针对 R 的应用程序以及在 R 上运行的最新 Android Studio 模拟器。似乎当 Studio 进行 Gradle 构建和清单合并时,构建工具会自动更改您的minSdk 到 R。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句