【问题标题】:Why does Android R SDK not working in Marshmallow?为什么 Android R SDK 在 Marshmallow 中不起作用?
【发布时间】:2020-02-25 09:35:35
【问题描述】:

我将我的 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 的 App

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
  • @NikosHidalgo 6.0.1 是 23 对吗?
  • 你能发布依赖列表吗?也许其他东西正在迫使更新的 minSdk

标签: android


【解决方案1】:

根据开发者预览website:

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。

【讨论】:

  • 但是问题是,如果设备在下方,那么它应该使用已经安装的SDK或显示选项来安装缺少的SDK。
  • @PoojaSingh 这种行为最终将在稳定版本之前被允许,但在开发者预览阶段不允许。目前,针对 R 的应用程序只能在 R 上运行的设备上运行
  • 我明白亲爱的。我告诉我,当我没有升级时,它运行在“R”以下。现在我升级到'R'。因此,如果设备是 Android 'R',那么它应该运行“R”,如果设备低于它,那么它应该运行已安装的 SDK。因为以前低于 R,所以即使我使用任何设备也没有显示任何异常。
  • @PoojaSingh 我不确定我是否关注你。 升级是什么意思?将gradle更改为指向android-R,下载工具v30?在 android studio 中为 R 添加了 sdk?创建了一个在 R 上运行的模拟器?上述所有的?那有什么问题呢?您是否尝试在未在 R 上运行的设备上启动不针对 R 的应用并收到上述错误?
  • 是的,最重要的是。情况是,我同时使用“R”模拟器和 6.0.1 平板电脑。我必须在两者中进行测试。这怎么可能?你告诉我!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-07-14
  • 1970-01-01
  • 2016-11-03
  • 1970-01-01
  • 2011-01-14
  • 1970-01-01
  • 2015-06-30
相关资源
最近更新 更多