本文参考自週莫 https://blog.csdn.net/weixin_40420578/article/details/100582094
问题:Android Studio 3.5 版本 ,新建Module 遇到
Project needs to be converted to androidx.* dependencies
方法一:项目适配AndroidX
旧项目不建议近期升级适配,还有很大一部分开源库,以及第三方商用SDK未适配AndroidX,冒然适配,可能会额外增加代码改动、测试组的工作量。
建议等一段时间,根据Android开发生态情况,再处理。
ps:新项目建议直接适配AndroidX
方法二:不适配AndroidX
step1: 项目下gradle.properties 添加如下,并同步
android.useAndroidX=true
android.enableJetifier=true

step2:正常新建module
new module -> next -> next ->finish -> gradle build
step3:将module下的build.gradle 的dependencies 修改非AndroidX
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
改为
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
step4:项目下gradle.properties 修改为如下,并同步
android.useAndroidX=false
android.enableJetifier=false
OK,done.
感谢:
CSDN博主 週莫
参考文章链接 https://blog.csdn.net/weixin_40420578/article/details/100582094
来源:CSDN
作者:Cupster_hub
链接:https://blog.csdn.net/Cupster/article/details/104248020