Edited 07.12.2018:
I think dependency for StringUtils you are using is not proper.
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):
compile 'org.apache.commons:commons-lang3:3.5'
Edit:
As OoDeLally mentioned in a comment,
Above mentioned version is deprecated, Please use below dependency:
implementation 'org.apache.commons:commons-text:1.9'
Edit 2:
deprecated as for July 2019. Use stackoverflow.com/a/55567755/1541141 instead
Thanks @OoDeLally!
Answer from AndiGeeky on Stack OverflowEdited 07.12.2018:
I think dependency for StringUtils you are using is not proper.
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):
compile 'org.apache.commons:commons-lang3:3.5'
Edit:
As OoDeLally mentioned in a comment,
Above mentioned version is deprecated, Please use below dependency:
implementation 'org.apache.commons:commons-text:1.9'
Edit 2:
deprecated as for July 2019. Use stackoverflow.com/a/55567755/1541141 instead
Thanks @OoDeLally!
for StringUtils you need to add in app.gradle
implementation 'org.apache.commons:commons-text:1.7'
Pick the ones you need and add them to build.gradle's dependencies block:
I recommend checking the link to make sure you are getting the latest version. Feel free to suggest edits.
collections: (link)
implementation 'org.apache.commons:commons-collections4:4.4'
lang: (link)
implementation 'org.apache.commons:commons-lang3:3.9'
compress: (link)
implementation 'org.apache.commons:commons-compress:1.19'
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.13'
http (link)
implementation 'org.apache.httpcomponents:httpclient:4.5.10'
validator (link)
implementation 'commons-validator:commons-validator:1.6'
math (link)
implementation 'org.apache.commons:commons-math3:3.6.1'
See all of the Apache libraries here
Place the jar file in the libs folder in the root of your module. Then File -> Project Settings. In the left side choose the module where you want to add this lib, in the right side choose tab Dependencies. In the bottom press Plus sign and click File dependency. Then choose your jar and sync project
These are the steps to add a local library as dependency (.jar):
- put the jar file into "libs" folder
- add the following line to your
build.gradle, insidedependencies:
compile fileTree(dir: 'libs', include: ['*.jar'])
like:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
Options in the links listed below actually helped me to achieve my objective properly:
- https://www.geeksforgeeks.org/how-to-import-external-jar-files-in-android-studio/
- https://medium.com/@jonathanmonga/how-to-add-libraries-in-android-studio-in-english-286db8b073c2