【问题标题】:Android Studio app doesn't install on emulator after androidx migrationandroidx 迁移后,Android Studio 应用程序未安装在模拟器上
【发布时间】:2019-09-15 19:58:31
【问题描述】:

我的依赖是:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'androidx.appcompat:appcompat:1.1.0'
    testImplementation 'junit:junit:4.12'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    implementation 'androidx.cardview:cardview:1.0.0'
}

我有一个在 Android Pie 上运行良好的应用程序,它使用了较旧的支持库。但是,我决定将其迁移到 AndroidX 以支持最新版本。我没有更改任何逻辑代码,只是允许 Studio(3.5) 更改导入。现在,当我测试它时,它在 Pie 上崩溃(即使我将目标 sdk 和/或编译 sdk 更改为 28),并且在带有 Android 10 的模拟器上它工作正常。我错过了什么?

【问题讨论】:

    标签: android android-studio migration androidx


    【解决方案1】:

    请确定;

    • 您的 com.android.tools.build:gradle 版本超过 3.2.0

    • 你的 gradle.properties 文件有 android.useAndroidX = true

    • 您的 Android Studio 版本高于您的 3.2 TargetSDK 版本和 compliedSDK 版本为 28 或更高版本。

    【讨论】:

    • 谢谢!我正在使用 Studio 3.5,我检查了所有,满足所有要求,但是,它仍然在 Pie 和更低版本上崩溃......
    猜你喜欢
    • 2011-07-01
    • 2015-02-12
    • 1970-01-01
    • 2022-06-27
    • 2011-06-04
    • 1970-01-01
    • 2015-10-14
    • 1970-01-01
    相关资源
    最近更新 更多