如何使用gradle将org.apache.commons.lang3添加到AndroidStudio [英] How to add org.apache.commons.lang3 to AndroidStudio with gradle
问题描述
由于此问题
我想在包org.apache.commons.lang3
中使用类StringEscapeUntils
.
Due to this question
I want to use class StringEscapeUntils
in package org.apache.commons.lang3
.
但是当我尝试通过在build.grade
文件中添加行compile 'org.apache.commons:commons-collections4:4.0'
来导入Apache
lib时,则无法导入上述类.
But when I try to import Apache
lib by add line compile 'org.apache.commons:commons-collections4:4.0'
to build.grade
file then can not import the class above.
有没有人可以帮助我如何通过gradle将以上一项导入到我的项目中(而不是通过下载.jar并将其放入项目文件夹中).
Is there any one can help me how to import above one to my project via gradle (not by download .jar and put them into project folder).
推荐答案
2018年12月7日
我认为对您使用的StringUtils
的依赖关系不合适.
I think dependency for StringUtils
you are using is not proper.
请在gradle和Sync项目中添加以下依赖项,然后导入您的类.
Please add below dependency to gradle and Sync project and import your class.
implementation 'org.apache.commons:commons-lang3:3.6'
此功能正在使用不推荐使用的任务(但仍然可以使用):
This on is using deprecated task (but should still works):
编译'org.apache.commons:commons-lang3:3.5'
如OoDeLally在评论中所述,
As OoDeLally mentioned in a comment,
上述版本已被弃用, 请使用以下依赖项:
Above mentioned version is deprecated, Please use below dependency:
implementation 'org.apache.commons:commons-text:1.6'
自2019年7月起弃用.改为使用 stackoverflow.com/a/55567755/1541141
deprecated as for July 2019. Use stackoverflow.com/a/55567755/1541141 instead
感谢@OoDeLally!
Thanks @OoDeLally!
这篇关于如何使用gradle将org.apache.commons.lang3添加到AndroidStudio的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!