Home » Android » How to import remote library in Android Studio using gradle?

How to import remote library in Android Studio using gradle?

Posted by: admin May 14, 2020 Leave a comment

Questions:

I am trying to import android-swipelistview (https://github.com/47deg/android-swipelistview) into my Android Studio module using gradle. Shouldn’t this be possible with build.gradle config alone? Does anyone have a config file(s) that does the job?

How to&Answers:

You can use:

compile 'com.nineoldandroids:library:2.4.0'

or if you have the library copied to your project libs directory, you can use:

compile files ('libs/ nineoldandroids-2.4.0.jar')

However, you can check out my post on getting started with swipelistview:
http://modewagon.wordpress.com/2013/09/16/getting-started-with-swipelistview/

Answer:

I was getting a Failed to Resolve error on this library. The fix for me was, in the build.gradle file, to change this:

repositories {
    mavenCentral()
}

to this:

repositories {
    jcenter {
        url "http://jcenter.bintray.com/"
    }
}

Answer:

If compile ‘com.nineoldandroids:library:2.4.0+’ doesn’t work,

try this -> compile ‘com.nineoldandroids:library:2.4.+’