2016-04-02 98 views
6

我有一個Android項目,可以與預gradle:2.1.0-alpha3版本完美配合。現在,它拋出此類錯誤,沒有線索如何解決這些問題:升級到gradle後無法編譯項目:2.1.0-alpha5

Error:Execution failed for task ':app:compileDebugJavaWithJavac'. 
> java.lang.NoSuchMethodError: com.google.common.collect.FluentIterable.append(Ljava/lang/Iterable;)Lcom/google/common/collect/FluentIterable; 

這是相當奇怪的,有一個特殊分支,在過去的四五天也用完就扔在APK重複的對象,details here

我的應用程序的模塊的build.gradle:

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.1.0-alpha5' 
     classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
    } 

    gradle.projectsEvaluated { 
     tasks.withType(JavaCompile) { 
      options.compilerArgs << "-Xlint:unchecked" 
     } 
    } 
} 

task clean(type: Delete) { 
    delete rootProject.buildDir 
} 

和我模塊的build.gradle:

apply plugin: 'com.android.application' 
apply plugin: 'com.neenbedankt.android-apt' 

android { 
    compileSdkVersion 23 
    buildToolsVersion '23.0.3' 

    defaultConfig { 
     applicationId "..." 
     minSdkVersion 14 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 
     multiDexEnabled true 
    } 
    dataBinding { 
     enabled = true 
    } 

    lintOptions { 
     disable 'InvalidPackage' 
    } 

    dexOptions { 
     javaMaxHeapSize "4g" 
     preDexLibraries = false 
    } 

    buildTypes { 
     release { 
      minifyEnabled true 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
     debug { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
    compileOptions { 
     sourceCompatibility JavaVersion.VERSION_1_7 
     targetCompatibility JavaVersion.VERSION_1_7 
    } 
} 

//PixlUI 
repositories { 
    maven { 
     url "https://jitpack.io" 
    } 
    mavenCentral() 
} 

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    // Dagger 2 
    apt 'com.google.dagger:dagger-compiler:2.0.2' 
    provided 'org.glassfish:javax.annotation:10.0-b28' 
    //Autodagger 
    apt 'com.github.lukaspili.autodagger2:autodagger2-compiler:1.1' 
    provided 'javax.annotation:jsr250-api:1.0' 

    compile 'com.android.support:design:23.2.1' 
    compile 'com.android.support:appcompat-v7:23.2.1' 
    compile 'com.android.support:cardview-v7:23.2.1' 
    compile 'com.android.support:recyclerview-v7:23.2.1' 
    compile 'com.google.android.gms:play-services-location:8.4.0' 
    compile 'com.google.android.gms:play-services-wallet:8.4.0' 
    compile 'com.google.android.gms:play-services-auth:8.4.0' 
    compile 'com.android.support:support-v4:23.2.1' 
    compile 'com.android.support:multidex:1.0.1' 
    compile 'com.google.dagger:dagger:2.0.2' 
    compile 'com.github.lukaspili.autodagger2:autodagger2:1.1' 
    compile 'de.hdodenhof:circleimageview:1.3.0' 
    compile 'net.steamcrafted:materialiconlib:[email protected]' 
    compile 'com.lorentzos.swipecards:library:[email protected]' 
    compile 'com.squareup.picasso:picasso:2.5.2' 
    compile 'de.greenrobot:eventbus:2.4.0' 
    compile 'com.jakewharton:butterknife:7.0.1' 
    compile 'com.github.neopixl:PixlUI:v1.0.6' 
    compile 'com.scottyab:secure-preferences-lib:0.1.4' 
    compile 'com.squareup.retrofit:retrofit:1.9.0' 
    compile 'io.card:android-sdk:5.3.0' 
    compile 'com.paypal.sdk:paypal-android-sdk:2.13.1' 
} 

任何形式的幫助或指針,不勝感激

+0

也試圖與SDK工具的建設和各項它與相同的結果V22依賴 – Chisko

+0

看起來像一個問題已經存在這個在[Android的bug跟蹤系統(HTTP ://b.android.com/205589)。該問題尚未解決。 –

回答

7

問題是與匕首的依賴。你需要使用新版本的匕首,即v2.1或更高版本。

(REF:官方issue

+0

這當然有訣竅。謝謝Avinash。現在我可以看到重複文件錯誤: 任務transformResourcesWithMergeJavaResForDebug'的執行失敗。 TransformException:在APK中複製的重複文件scala-asm.properties File1:C:\ Users \ Lenovo \ .gradle \ caches \ modules-2 \ files-2.1 \ org.scala-lang.modules \ scala-asm \ 5.0。 4-scala-3 \ ec0b54860f2fec77be8c6b7a8cc85c638c697427 \ scala-asm-5.0.4-scala-3.jar File2:C:\ Users \ Lenovo \ .gradle \ caches \ modules-2 \ files-2.1 \ org.typelevel \ scala-編譯器\ 2.11.7 \ f73061d1ba36b2dbefeb359c91253ae2d201ed7b \ scala-compiler-2.11.7.jar 對此有何想法? – Chisko

+0

如果你可以確認解決方案也在官方bug也是有幫助的 –

+1

我也評論了官方bug,併發布了關於其他錯誤的新問題http://stackoverflow.com/questions/36413778/ gradle-gradle2-1-0-alpha5-is-compiling-duplicate-objects-in-apk。再次感謝Avinash – Chisko

相關問題