完美解决:Project needs to be converted to androidx.* dependencies

完美解决:Project needs to be converted to androidx.* dependencies

完美解决:Project needs to be converted to androidx.* dependencies

週莫 2019-09-06 17:03:31 完美解决:Project needs to be converted to androidx.* dependencies 37980 完美解决:Project needs to be converted to androidx.* dependencies 收藏 30

分类专栏: AS配置笔记

版权

Android Studio升级到3.5后,原先项目引入的是android,现在新建module时有Project needs to be converted to androidx.* dependencies,而且Finish是灰色,无法创建,现在提供两种解决方法:

方法一:把整个项目升级到AndroidX,可参考我的另外一篇博客:https://blog.csdn.net/weixin_40420578/article/details/100132061

 

方法二:项目不升级到AndroidX

一开始新建module_test时,如下图:

完美解决:Project needs to be converted to androidx.* dependencies

 

 

步骤一:gradle.properties(Global Properties)下添加:

 
  1. android.useAndroidX=true

  2. android.enableJetifier=true

点一下右上角Sync Now

 

步骤二:新建module_test,这时就没有Project needs to be converted to androidx.* dependencies 如下图:

完美解决:Project needs to be converted to androidx.* dependencies

File——New——New Module——Android Library(Next)——填好信息后Finish

 

 

步骤三:把module_test的build.gradle——dependencies下引入的androidX包改成android的,如果不知道怎么改,就从原先的module对应的build.gradle里拷贝过来

 

步骤四:在步骤一种添加的改成false

 
  1. android.useAndroidX=false

  2. android.enableJetifier=false

同步一下即可 

如果有不足之处,请指出,谢谢!