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

huangapple go评论88阅读模式
英文:

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

问题

I am getting this issue:

这个项目使用了AndroidX的依赖库,但是'android.useAndroidX'属性没有被启用。在gradle.properties文件中将这个属性设置为true,然后重试。

以下AndroidX依赖库已被检测到:androidx.annotation:annotation:1.1.0

我一直在遇到这个错误,我一直在网上搜索以找出问题出在哪里,但是我找不到任何解决方法。

"而且我不能在我的项目中使用Androidx库"

英文:

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

得分: 2

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:

我在许多关于这个问题的Stack Overflow回答中都建议排除'META-INF/DEPENDENCIES'和其他一些排除项。然而,这些都对我不起作用。在我的情况下,情况如下:

I had added this in dependancies:

我在依赖中添加了这个:

implementation 'androidx.annotation:annotation:1.1.0'

And also I had added this in gradle.properties:

而且我还在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

我都添加了这两个,因为我遇到了构建错误'cannot find symbol class Nullable',并且有些答案中建议这样做,就像这里一样

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

没有排除项对我起作用。最后,我只是将它从build.gradle文件中删除了。

implementation 'androidx.annotation:annotation:1.1.0'

from build.gradle file.

从build.gradle文件中删除了'androidx.annotation:annotation:1.1.0'。

and finally I got rid of this

最后我摆脱了这个问题

( https://stackoverflow.com/questions/63227992/more-than-one-file-was-found-with-os-independent-path-androidsupportmultidexver )

"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.

最后,我成功构建了我的apk文件,没有任何错误。

英文:

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

( https://stackoverflow.com/questions/63227992/more-than-one-file-was-found-with-os-independent-path-androidsupportmultidexver )

"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

huangapple
  • 本文由 发表于 2020年8月3日 19:11:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/63228364.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定