Ibr*_*dan 55 java android gradle android-studio pagerslidingtabstrip
我想将一个库项目导入我的应用程序,但每当我尝试这样做时,Android Studio都无法识别它
它还给我build.gradle中的错误..
图书馆是:PagerSlidingTabStrip ....
这是一些图片:
到目前为止,我一直试图让它工作3天!请帮我 :)
编辑:
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'
Run Code Online (Sandbox Code Playgroud)
编辑2:
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
Run Code Online (Sandbox Code Playgroud)
Gab*_*tti 54
首先,您可以将此依赖项添加到项目中,而无需在本地编译lib.
dependencies {
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
}
Run Code Online (Sandbox Code Playgroud)
否则,如果要在本地编译此lib,则必须在根目录中的gradle.properties中定义这些键.
ANDROID_BUILD_TARGET_SDK_VERSION=19
ANDROID_BUILD_TOOLS_VERSION=19
ANDROID_BUILD_SDK_VERSION=19
Run Code Online (Sandbox Code Playgroud)
mdz*_*eko 38
编辑
这样做还有一种GUI方式.通过facebook在项目树中选择模块并按下来访问它f4.
您也可以右键单击facebook并转到Open Module Settings底部附近.
它显示在图片中.在撰写本文时,图片中的数字是顶级sdk版本.


有一个更简单的解决方案.类似的常量ANDROID_BUILD_SDK_VERSION可以用普通版"数字"代替.而不是
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)
}
Run Code Online (Sandbox Code Playgroud)
..file可以是这样的:
android {
compileSdkVersion 19
buildToolsVersion '19.1.0'
defaultConfig {
minSdkVersion 15
targetSdkVersion 19
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
44285 次 |
| 最近记录: |