Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add commons-math library in Android Studio

I am trying to import common-math library to my Android Studio project. I placed the file commons-math3-3.6.1.jar file in libs folder and in the gradle file I have this line:

compile 'commons-math3-3.6.1.jar'

But I get this error: `

Error:(32, 0) Supplied String module notation 'commons-math3-3.6.1.jar' is invalid. Example notations: 'org.gradle:gradle-core:2.2', 'org.mockito:mockito-core:1.9.5:javadoc'.

Can anyone tell me what I have to do?

like image 919
I Madalina Avatar asked Jun 18 '16 00:06

I Madalina


People also ask

How do I import Apache Commons Math?

download the jar file, extract it locally. Open eclipse, project-property-java build path-libraries-add library, where you add the extracted folder there. then you can use the import org. apache.

What is Commons math3?

Commons Math is a library of lightweight, self-contained mathematics and statistics components addressing the most common problems not available in the Java programming language or Commons Lang.


2 Answers

Is there a reason you need to use the jar file? You can get the file directly from Maven repository using something like this:

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

Available on both JCenter and MavenCentral.

like image 70
Owais Ali Avatar answered Oct 19 '22 16:10

Owais Ali


in Android view open Gradle Scripts - build.gradle and add this to dependencies:

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

You can also check their websites if newer version isn't available list of latest versions

like image 7
Rezor Avatar answered Oct 19 '22 15:10

Rezor