Getting Androidx library issue even though its not enabled in android project

▼魔方 西西 提交于 2020-08-06 06:09:51

问题


I am getting this issue

This project uses AndroidX dependencies, but the 'android.useAndroidX' property is not enabled. Set this property to true in the gradle.properties file and retry.

The following AndroidX dependencies are detected: androidx.annotation:annotation:1.1.0

I keep getting this error and I have been searching the internet to figure out what is wrong and I cannot find anything

"And I can't use Androidx library in my project "


回答1:


In many of the answers on SO on this problem it has been suggested to add exclude 'META-INF/DEPENDENCIES' and some other excludes. However none of these worked for me. In my case scenario was like this:

I had added this in dependancies:

implementation 'androidx.annotation:annotation:1.1.0'

And also I had added this in gradle.properties:

android.useAndroidX=true

Both of these I had added, because I was getting build error 'cannot find symbol class Nullable' and it was suggested as solution to this on some of answers like here

However, eventually I landed up in getting error:

 More than one file was found with OS independent path 'androidsupportmultidexversion.txt'

No exclude was working for me. Finally I just removed

implementation 'androidx.annotation:annotation:1.1.0'

from build.grdle file. and finally I got rid of this

( More than one file was found with OS independent path 'androidsupportmultidexversion.txt' )

"More than one file was found with OS..." build error.

I wasted hours of mine.But didn't found solution of this. Then i just change my project

minSdkVersion 19 

to

 minSdkVersion 21 

And finally i am able to build my apk file without any error



来源:https://stackoverflow.com/questions/63228364/getting-androidx-library-issue-even-though-its-not-enabled-in-android-project

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