1

I Added a External Library to my project by following this method. and tried this method too this method too. Gradle build got Finished and i got this line added to my build.gradle

compile 'com.github.castorflex.smoothprogressbar:library-circular:1.0.1'

Now i am trying to import this library in my class. But i can't do this. I took a look at the files and they are located in the build directory under the exploded-aar. so i added @aar to the compile line. Still there are no changes.

How can i import this library to my class or where i am going wrong?

Thanks in Advance

Community
  • 1
  • 1
AruLNadhaN
  • 2,808
  • 5
  • 24
  • 42

4 Answers4

7

Well, you don't need to download anything or point your dependency to a file.

This dependency, as most of the dependencies you use, can automatically fetched from JCenter, biggest repository for Java and Android components.

All you need to do is:

  1. Add JCenter as your dependencies repository.
  2. Declare that you need the library-circular dependency. This can be found and copy/pasted from the file icon in particular package/version in JCenter.
  3. Resync your Android Studio project with your Gradle build file. This is the 'sync' button in Gradle pane in Android Studio.

Here's what your build.gradle should include:

repositories {
    jcenter()
}

dependencies {
    compile(group: 'com.github.castorflex.smoothprogressbar', name: 'library-circular', version: '1.0.1', ext: 'aar')
}
JBaruch
  • 22,610
  • 5
  • 62
  • 90
2

in build. gradle put following code dependencies { compile fileTree (dir: 'libs', include: ['*.jar'])

}

0

Did you add the dependencies?

You can do so in the following way -

dependencies {
compile files('insert ParentFolder/external_library_name with the extension here')
}

Add it to build.gradle based in the app folder

Slay
  • 221
  • 1
  • 5
  • 12
  • The emphasis was on my last statement. Which build.gradle file did you add it to? You're supposed to add it to the one under app. Not the one in the parent structure. – Slay Oct 21 '14 at 07:59
0

1.Put the jar file into the libs folder.

2.Right click it and hit 'Add as library'.

3.Ensure that compile files('libs/abcdef.jar') is in your build.gradle file and Finally add the dependencies.

Eg.

dependencies {

    compile fileTree(dir: '../jar', include: '*.jar')

    compile project(':pull-to-refresh')

    compile files('libraries/abcdef.jar')
}

Hope this helps :)

Ankit Arora
  • 117
  • 4