5

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?

Phiter
  • 14,570
  • 14
  • 50
  • 84
I Madalina
  • 63
  • 1
  • 3

2 Answers2

9

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.

Owais Ali
  • 724
  • 1
  • 6
  • 14
8

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

Rezor
  • 126
  • 1
  • 3