解决AS3.5无法新建Module:Project needs to be converted to androidx.* dependencies

匆匆过客 提交于 2020-02-10 16:41:59

本文参考自週莫 https://blog.csdn.net/weixin_40420578/article/details/100582094


问题:Android Studio 3.5 版本 ,新建Module 遇到
Project needs to be converted to androidx.* dependencies
在这里插入图片描述

方法一:项目适配AndroidX

参考 週莫 Android项目升级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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!