简体   繁体   English

androidx迁移后,Android Studio应用程序未安装在模拟器上

[英]Android Studio app doesn't install on emulator after androidx migration

my dependencies are: 我的依赖项是:

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'
}

I had an app which worked fine on Android Pie and it used older support libraries. 我有一个可以在Android Pie上正常运行的应用程序,它使用了较早的支持库。 However, I decided to migrate it to AndroidX to be able to support the latest version. 但是,我决定将其迁移到AndroidX以支持最新版本。 I didn't change any logical code, just allowed the Studio(3.5) to change the imports. 我没有更改任何逻辑代码,只是允许Studio(3.5)更改导入。 Now when I test it it crashes on Pie (even when i change the target sdk and/or compilation sdk to 28) and on emulator with Android 10 it works fine. 现在,当我对其进行测试时,它会在Pie上崩溃(即使我将目标sdk和/或编译sdk更改为28),在Android 10模拟器上也能正常运行。 What have I missed? 我错过了什么?

Be sure that; 请确保;

  • Your com.android.tools.build:gradle version is more that 3.2.0 您的com.android.tools.build:gradle版本大于3.2.0

  • Your gradle.properties file has android.useAndroidX = true 您的gradle.properties文件具有android.useAndroidX = true

  • Your Android studio version is higher than 3.2 your TargetSDK verion and compliedSDK version is 28 or greater. 您的Android Studio版本高于3.2,而您的TargetSDK版本高于,而compliedSDK版本则为28或更高。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM