Android needs to be converted to androidx. * Dependencies when creating a new module

After Android Studio was upgraded to 3.5, the original project was introduced to android, and now there are Project needs to be converted to androidx. * Dependencies when creating a new module, and Finish is gray and cannot be created.

Two solutions are now provided :

1. Upgrade the project to AndroidX
https://blog.csdn.net/weixin_40420578/article/details/100132061

Second, the project does not upgrade to AndroidX

Follow the steps:

1. Modify in the gradle.properties file of the project:

android.useAndroidX=true
android.enableJetifier=true

2. New Module

new-> Module-> select Android Library-> you will not be prompted at this time, and you can Finsh

3. Because the newly created Module is AndroidX, you need to change the Module to Android

3-1 Modified in the gradle.properties file of the project:

android.useAndroidX=false
android.enableJetifier=false

3-2 Modify in build.gradle in Module as follows, modify all the places related to Androidx to Android

defaultConfig {
        ...
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        ...
    }

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
}
Published 60 original articles · 25 praises · 10,000+ views

Guess you like

Origin blog.csdn.net/qq_41466437/article/details/105289870