Reputation: 1085
I want to import library project to my project in Android studio I don't know why this is such a big deal in android stuido !! ... please someone help me
Upvotes: 0
Views: 1191
Reputation: 1085
To import a library .. lets say actionbarsherlcok
copy to the library folder to your project folder .. or to "libs" folder inside your project folder .. manually .. not in the IDE
make sure your minSdkVersion, targetSdkVersion, compileSdkVersion, buildToolsVersion are the same in build.gradle in your project directory and in your library directory.
android {
compileSdkVersion 19
buildToolsVersion "19.0.1"
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
}
make sure that in your AndroidManifest.xml in your project and library directory has the same minSdkVersion and targetSdkVersion like above
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19" />
in your main project directory open "settings.gradle" then type your library directory name
include ':actionbarsherlock'
if you put it in libs folder then it will be
include ':libs\actionbarsherlock'
** if you imported a library project with a sample project and it doesn't work do the same steps and also
open gradle > wrapper > gradle-wrapper.properties and change distributionUrl to the latest gradle version .. in my case
distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-bin.zip
then in the main directory of the project open "build.gradle" and change the dependencies to
dependencies {
classpath 'com.android.tools.build:gradle:0.8.+'
}
then clean project and rebuild
that's it .. that worked with me in Android Studio 0.4.3
Upvotes: 1