I Madalina
I Madalina

Reputation: 63

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?

Upvotes: 5

Views: 9148

Answers (2)

Rezor
Rezor

Reputation: 136

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

Upvotes: 8

Owais Ali
Owais Ali

Reputation: 724

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.

Upvotes: 9

Related Questions