在 Android Studio 中导入 Facebook 库:找不到属性“ANDROID_BUILD_SDK_VERSION" [英] Importing Facebook library in Android Studio: Could not find property 'ANDROID_BUILD_SDK_VERSION'
问题描述
我想将一个库项目导入到我的应用程序中,但每当我尝试这样做时,Android Studio 都无法识别它
I want to import a library project into my app but whenever I try to do so , Android Studio doesn't recognise it
它也给了我 build.gradle 中的错误..
It also gives me errors in build.gradle ..
图书馆是:PagerSlidingTabStrip ....
The Library is : PagerSlidingTabStrip ....
这里有一些图片:
到目前为止,我一直在努力让它工作 3 天!!请帮助我:)
I have been trying to make it work for 3 days so far !! Please Help Me :)
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
推荐答案
首先,您可以将此依赖项添加到您的项目中,而无需在本地编译 lib.
First of all, you can add this dependency to your project, without compiling the lib locally.
dependencies {
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
}
否则如果你想在本地编译这个库,你必须在根目录的 gradle.properties 中定义这些键.
Otherwise if you would like to compile this lib locally, you have to define these keys in gradle.properties in the root.
ANDROID_BUILD_TARGET_SDK_VERSION=19
ANDROID_BUILD_TOOLS_VERSION=19
ANDROID_BUILD_SDK_VERSION=19
这篇关于在 Android Studio 中导入 Facebook 库:找不到属性“ANDROID_BUILD_SDK_VERSION"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!