我将我的gradle从1.6更新为1.8以构建我的Android应用程序。但无论我使用gradle
还是gradle clean
,我都会依赖'> Loading > Resolving dependencies ':lib/actionbarsherlock:classpath''
更重要的是,一切都适合gradle 1.6
我的build.gradle如下:
root build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5+'
}
}
allprojects {
repositories {
maven {
url "http://maven.oschina.net/content/groups/public"
}
}
}
setting.gradle:
include 'lib/library1'
include 'lib/actionbarsherlock'
include 'lib/library'
include 'qingdaobus160'
actionbarsherlock的build.gradle:
buildscript {
repositories {
maven {
url "http://maven.oschina.net/content/groups/public"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6+'
}
}
apply plugin: 'android-library'
dependencies {
compile files('libs/android-support-v4.jar')
}
android {
compileSdkVersion 18
buildToolsVersion "18.0.1"
sourceSets {
main {
manifest {
srcFile 'AndroidManifest.xml'
}
java {
srcDir 'src'
}
res {
srcDir 'res'
}
assets {
srcDir 'assets'
}
resources {
srcDir 'src'
}
aidl {
srcDir 'src'
}
}
}
}
主要项目:
buildscript {
repositories {
maven {
url "http://maven.oschina.net/content/groups/public"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android'
android {
compileSdkVersion 18
buildToolsVersion "18.0.1"
dependencies {
compile project(":lib/actionbarsherlock")
compile project(":lib/library")
compile project(":lib/library1")
compile fileTree(dir: 'libs', include: '*.jar')
}
sourceSets {
main {
manifest {
srcFile 'AndroidManifest.xml'
}
java {
srcDir 'src'
}
res {
srcDir 'res'
}
assets {
srcDir 'assets'
}
resources {
srcDir 'src'
}
aidl {
srcDir 'src'
}
}
}
}
tasks.withType(Compile) {
options.encoding = "UTF-8"
}
task copyNativeLibs(type: Copy) {
from fileTree(dir: 'libs', include: '**/*.so' ) into 'build/native-libs'
}
tasks.withType(Compile) { compileTask -> compileTask.dependsOn copyNativeLibs }
clean.dependsOn 'cleanCopyNativeLibs'
tasks.withType(com.android.build.gradle.tasks.PackageApplication) { pkgTask ->
pkgTask.jniDir file('build/native-libs')
}
答案 0 :(得分:1)
要解决您的问题,您必须更新此部分:
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
到
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
因为Gradle 1.8需要0.6.3。
然后你必须修改settings.gradle:
include ':lib:library1'
include ':lib:actionbarsherlock'
include ':lib:library'
include ':qingdaobus160'
你应该有这个结构:
root
- qingdaobus160
build.gradle
- lib
- library
build.gradle
- library1
build.gradle
- actionbarsherlock
build.gradle
build.gradle
settings.gradle
你必须在:
修改qingdaobus160 / build.gradledependencies {
compile project(":lib:actionbarsherlock")
compile project(":lib:library")
compile project(":lib:library1")
compile fileTree(dir: 'libs', include: '*.jar')
}
为了改善项目,我建议你改变
dependencies {
compile files('libs/android-support-v4.jar')
}
到
compile 'com.android.support:support-v4:18.0.0'
或
compile 'com.android.support:support-v4:19.0.0'
最后,您可以使用sarlock操作栏,而不是本地库。 改变
compile project(":lib/actionbarsherlock")
与
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
您可以从settings.gradle
中删除本地abs库和include 'lib/actionbarsherlock'