Importing org.apache.commons into android applications

Hay, how do i import org.apache.commons packages into android so i can use them in my applications?

Thanks


Asked by: Marcus479 | Posted: 20-01-2022






Answer 1

If you're using eclipse:

  1. Download jar packages for libraries you are interested in
  2. Go to project properties in eclipse -> Java Build Path -> Libraries. Add External JARs here.

Answered by: Max115 | Posted: 21-02-2022



Answer 2

Just for completeness' sake - if you aren't using eclipse to develop and you are building with ant - just put the jar in your libs folder of your project.
Done!

Answered by: Chelsea579 | Posted: 21-02-2022



Answer 3

Also, be warned that not all of them can be automatically converted to Dalvik. For example commons-httpclient does not convert cleanly from the release binaries, you need to go through source to make it work.

Answered by: Sarah175 | Posted: 21-02-2022



Answer 4

If you are using android Stuido - that doesn't yet supports adding libraries - you need to edit the src/build.gradle

I wanted to add org.apache.commons.net and My file called 'org.apache.commons.net.jar' was placed in the libs folder, so my build.gradles dependencies look now like this:

dependencies {
    compile files('libs/android-support-v4.jar')
    compile files('libs/org.apache.commons.net.jar')
}

Answered by: Miller137 | Posted: 21-02-2022



Similar questions

android - Commons Math - could not find class org.apache.commons

I have downloaded the binary Zip from here. I extracted the zip to a folder. Then I right clicked on libs folder in Eclipse. I Imported the *.jar file to the libs folder, and then I right clicked on it and added to path. I added import org.apache.commons.math3.stat.descriptive...


org.apache.commons in Android Studio build.gradle file

I've got an old Android project with the following build.gradle file: apply plugin: 'com.android.application' buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:2.1.3' } } android { compileSdkVersion 23 buildToolsVersion "23.0.2" defaultConfig { minSdkVersion 14 targetSdkVersion 23 vers...


java - Duplicate class org.apache.commons

I am trying to run a build on Android. I'm in the process of building a React-Native bridge for a Java library. However, I am getting a Duplicate class error which looks like follows: Duplicate class org.apache.commons.lang3.builder.CompareToBuilder found in modules commons-lang3-3.9.jar (org.apache.commons:commons-lang3:3.9) and creditCardNfcReader-1.0.3-runtime.jar (com.github.pro100svitlo:...






Still can't find your answer? Check out these communities...



Android Google Support | Android Community | Android Community (Facebook) | Dev.io Android



top