英文:
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
最后我摆脱了这个问题
"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
"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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论