Twitter khuong291
Twitter khuong291

Reputation: 11702

Get the issue with import external library in Android Studio

I want to import the library https://github.com/jpardogo/FlabbyListView

First, I download the Zip file, then I extract it then I copy it to the lib folder of my project, then I turn on my project in Android Stduio. I add this line in the build.gradle compile 'com.jpardogo.flabbylistview:library:(latest version)'. But the Android Studio show:

enter image description here

How can I fix it?

Upvotes: 0

Views: 341

Answers (2)

Ibukun Muyide
Ibukun Muyide

Reputation: 1298

if you are manually adding the library to android. then you will add it to you project also. In you settings.gradle file for the project add

include ':nameoflibrary' 

or

include 'lib:nameoflibrary'

Where lib is the name of the folder you added the library and nameoflibrary is the actual name of the library.

then in you actual module usually the app-module gradle file add

dependencies {
compile project(':nameoflibrary')
}

or

dependencies {
compile project('lib:nameoflibrary')
}

same analogy too.

But if you are adding it from the repository you only need to add this line of code in your app-module gradle

dependencies {

 compile 'com.jpardogo.flabbylistview:library:(latest version)' 

}

Upvotes: 0

droidpl
droidpl

Reputation: 5892

You are mixing two concepts. If you use the compile dependency you don't have to put the jar in libs, and if you put the jar, don't put the managed dependency.

What the line compile library:artifact:version does is putting in your classpath in compile time the corresponding library, downloading it for you from a maven repository.

That said, I suggest you to remove the .jar and change your line of compile to:

compile 'com.jpardogo.flabbylistview:library:1.0.0

Upvotes: 2

Related Questions