Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.NoSuchMethodError on compile

I'm trying to compile an Android project unsuccessfully. The error message is:

Execution failed for task ':mobile:_compileAppDebug'.

java.lang.NoSuchMethodError: com.google.auto.common.MoreTypes.asTypeElements(Ljavax/lang/model/util/Types;Ljava/lang/Iterable;)Lcom/google/common/collect/ImmutableSet;

Here are my module's gradle dependencies in which I specify a number of libraries including google Auto:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':library')
    compile 'com.google.dagger:dagger:2.0-SNAPSHOT'
    provided 'com.google.auto.value:auto-value:1.0-rc1'
    apt 'com.google.dagger:dagger-compiler:2.0-SNAPSHOT'
    provided 'org.glassfish:javax.annotation:10.0-b28' 
    compile 'com.jakewharton:butterknife:6.1.0' 
    compile 'com.f2prateek.dart:dart:1.1.0'
}

When I looked at the dependencies I thought I just needed google auto value since that is where the missing method resides but adding the provided does not resolve the issue.

The project gradle file includes the retrolambda plugin

dependencies {
    classpath 'me.tatarka:gradle-retrolambda:2.5.0'
    classpath 'com.android.tools.build:gradle:1.0.1'
    classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.+'
    classpath 'io.fabric.tools:gradle:1.+'
    classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}

Can anyone help me identify which dependencies cause the compile error? Interestingly enough, when I copy the gradle files into an empty project everything runs fine.

like image 514
t3rse Avatar asked Feb 03 '15 23:02

t3rse


1 Answers

Dagger 2.0-SNAPSHOT depends on an Auto SNAPSHOT which had an API change: https://github.com/google/dagger/issues/113

This is perfectly normal and acceptable thing for libraries which are under development. If you cannot tolerate an occasional broken build, do not depend on non-release versions in a manner that can change at any time without warning.

like image 178
Jake Wharton Avatar answered Oct 09 '22 07:10

Jake Wharton