How to add apache collections collection in Android Studio (Gradle)

I am trying to use ListUtils but when I started the application, I got this error:

Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.commons.collections.ListUtils" on path: DexPathList[[zip file "/data/app/com.meridianaspect.wiw-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]] 

So it seems to me that I need to somehow import this library through gradle, but I don't know how to do this?

+86
android android-studio gradle
May 15 '15 at 12:07
source share
2 answers

Put the jar file in the libs folder in the root directory of your module. Then File โ†’ Project Settings. In the left part, select the module into which you want to add this library, in the right part, select the "Dependencies" tab. At the bottom, click "Plus" and select "File." Then select jar project and sync

+6
May 15 '15 at 12:10
source share

Select the ones you need and add them to build.gradle dependencies:

I recommend checking the link to make sure you are getting the latest version. Feel free to suggest changes.

collections : (link)

 implementation 'org.apache.commons:commons-collections4:4.3' 

lang : (link)

 implementation 'org.apache.commons:commons-lang3:3.9' 

compress : (link)

 implementation 'org.apache.commons:commons-compress:1.18' 

net : (link)

 implementation 'commons-net:commons-net:3.6' 

IO : (link)

 implementation 'commons-io:commons-io:2.6' 

exec (link)

 implementation 'org.apache.commons:commons-exec:1.3' 

codec (link)

 implementation 'commons-codec:commons-codec:1.12' 

http (link)

 implementation 'org.apache.httpcomponents:httpclient:4.5.5' 

validator (link)

 implementation 'commons-validator:commons-validator:1.6' 

math (link)

 implementation 'org.apache.commons:commons-math3:3.6.1' 



View all Apache libraries here

+374
Jul 18 '15 at 23:58
source share



All Articles