2013-12-16 71 views
3

我更新我的gradle從1.6到1.8來構建我的Android應用程序。但不管我用gradle還是gradle clean gradle都會掛在'> Loading > Resolving dependencies ':lib/actionbarsherlock:classpath''
更重要的是,一切都適合gradle 1.6。
我的build.gradle低於:

根的build.gradle:Gradle 1.8掛起解決Android的依賴關係,但1.6正常

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') 
} 

回答

1

要解決你的問題,你必須更新此部分:因爲搖籃1.8需要

dependencies { 
       classpath 'com.android.tools.build:gradle:0.5.+' 
     } 

dependencies { 
       classpath 'com.android.tools.build:gradle:0.6.+' 
     } 

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.gradle中:

dependencies { 
       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' 

最後,你可以使用AAR格式福爾摩斯行動起來吧,而不是本地庫。 變化

compile project(":lib/actionbarsherlock") 

compile 'com.actionbarsherlock:actionbarsherlock:[email protected]' 

您可以移除本地ABS庫,並include 'lib/actionbarsherlock'從settings.gradle

相關問題