I want to import a library project into my app but whenever I try to do so , Android Studio doesn't recognise it
It also gives me errors in build.gradle ..
The Library is : PagerSlidingTabStrip ....
Here are some pictures :
I have been trying to make it work for 3 days so far !! Please Help Me :)
EDIT:
apply plugin: 'android-library'
dependencies {
compile 'com.android.support:support-v4:19.0.0'
}
android {
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
defaultConfig {
minSdkVersion 8
targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
}
}
}
apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle'
EDIT2 :
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':Sahertoday'.
> Could not resolve all dependencies for configuration ':Sahertoday:_debugCompile'.
> Could not find com.astuetz:pagerslidingtabstrip:1.0.1.
Required by:
Saher-3:Sahertoday:unspecified
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
First of all, you can add this dependency to your project, without compiling the lib locally.
Otherwise if you would like to compile this lib locally, you have to define these keys in gradle.properties in the root.
Go the facebook folder which you have imported in your project. Copy the gradle.properties file and paste in into your facebook module.It will remove the errors.
For those who ran into same problems while adding libraries and still can't get it work. The following local include of the .aar file worked for me:
Android Studio does the rest (in the build.gradle) for you. Maybe clean and rebuild your project.
EDIT
There is also a GUI way for doing this. It is accessed by selecting the module
facebook
in the project tree and pressingf4
.Also you can just right-click the
facebook
and go toOpen Module Settings
near the bottom.It is shown in the pictures. The numbers in the picture are top sdk version at the time of writing.
There is a simpler solution. The constants like
ANDROID_BUILD_SDK_VERSION
can be replaced with normal version "numbers". So instead of..file can look like this: