我有一个与pre-gradle完美配合的
Android项目:2.1.0-alpha3版本.现在它正在抛出这些错误而不知道如何解决它们:
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:1.0.3@aar' compile 'com.lorentzos.swipecards:library:1.0.9@aar' 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' }
非常感谢任何类型的帮助或指针
解决方法
问题在于匕首的依赖性.你需要使用新版本的匕首,即v2.1或更高版本.
(参考:官方issue)