2016-04-20 20 views
11

Nach Aktualisierung auf Grad 2.10 jedes Mal, wenn ich versuche, assemble Debug Build der App bekomme ich die NoSuchMethodError Ausnahme. Hier ist der relevante Teil des Build-Log:Databinding schlägt fehl mit NoSuchMethodError

java.lang.RuntimeException: failure, see logs for details. 
    cannot generate view binders java.lang.NoSuchMethodError: com.google.common.base.Strings.isNullOrEmpty(Ljava/lang/String;)Z 
    at android.databinding.tool.util.StringUtils.capitalize(StringUtils.java:57) 
    at android.databinding.tool.util.ParserHelper.toClassName(ParserHelper.java:23) 
    at android.databinding.tool.store.ResourceBundle$LayoutFileBundle.getFullBindingClass(ResourceBundle.java:551) 
    at android.databinding.tool.store.ResourceBundle$LayoutFileBundle.getBindingClassPackage(ResourceBundle.java:541) 
    at android.databinding.tool.CompilerChef.pushClassesToAnalyzer(CompilerChef.java:124) 
    at android.databinding.tool.CompilerChef.createChef(CompilerChef.java:73) 
    at android.databinding.annotationprocessor.ProcessExpressions.writeResourceBundle(ProcessExpressions.java:148) 
    at android.databinding.annotationprocessor.ProcessExpressions.onHandleStep(ProcessExpressions.java:82) 
    at android.databinding.annotationprocessor.ProcessDataBinding$ProcessingStep.runStep(ProcessDataBinding.java:154) 
    at android.databinding.annotationprocessor.ProcessDataBinding$ProcessingStep.access$000(ProcessDataBinding.java:139) 
    at android.databinding.annotationprocessor.ProcessDataBinding.process(ProcessDataBinding.java:66) 

Wie Sie Methode sehen com.google.common.base.Strings.isNullOrEmpty nicht gefunden werden kann.

Einige Besonderheiten

verwende ich Retrolambda 3.2.5 und Java 8. Es gibt keine andere zusätzliche Plugins.

Build-Plugin-Version: com.android.tools.build:gradle:2.0.0

Build-Tools Version: 23.0.3

OS: OS X

build.gradle sieht wie folgt aus. Ich änderte es etwas, um einige private Sachen nicht zu entlarven, aber Problem ist noch dort.

buildscript { 
    repositories { 
     jcenter() 
     mavenCentral() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.0.0' 
     classpath 'me.tatarka:gradle-retrolambda:3.2.3' 
    } 
} 

apply plugin: 'com.android.application' 
apply plugin: 'me.tatarka.retrolambda' 

project.version = '1.0.0' 

afterEvaluate { 
    tasks.matching { 
     it.name.startsWith('dex') 
    }.each { dx -> 
     if (dx.additionalParameters == null) { 
      dx.additionalParameters = [] 
     } 
     dx.additionalParameters += "--set-max-idx-number=50000" // default 60000 
    } 
} 

def googleApiKey = "key goes here" 
def appVersionCode = 1 
def appVersionName = project.version + "." + appVersionCode 

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.3" 
    defaultConfig { 
     minSdkVersion 15 
     targetSdkVersion 23 
     manifestPlaceholders = [googleApiKey : googleApiKey, 
           appVersionCode: appVersionCode, 
           appVersionName: appVersionName] 
     multiDexEnabled true 

     ndk { 
      abiFilters "armeabi", "armeabi-v7a" 
     } 
    } 

    buildTypes { 
     release { 
      minifyEnabled true 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.cfg' 

      applicationVariants.all { variant -> 
       variant.outputs.each { output -> 
        output.outputFile = new File(
          output.outputFile.parent, 
          "App-${project.version}-${appVersionCode}.apk" 
        ) 
       } 
      } 
     } 

     compileOptions { 
      sourceCompatibility JavaVersion.VERSION_1_8 
      targetCompatibility JavaVersion.VERSION_1_8 
     } 
    } 

    flavorDimensions "multidex", "leakcanary" 

    productFlavors { 
     withLeakCanary { 
      dimension "leakcanary" 
     } 

     withoutLeakCanary { 
      dimension "leakcanary" 
     } 

     develDex { 
      dimension "multidex" 
      minSdkVersion 21 
      targetSdkVersion 23 
     } 

     prodDex { 
      dimension "multidex" 
      minSdkVersion 15 
      targetSdkVersion 23 
     } 
    } 
    packagingOptions { 
     exclude 'META-INF/LICENSE.txt' 
     exclude 'META-INF/LICENSE' 
     exclude 'META-INF/NOTICE.txt' 
     exclude 'META-INF/NOTICE' 
     exclude 'META-INF/DEPENDENCIES' 
    } 
    lintOptions { 
     abortOnError false 
    } 
    sourceSets { 
     main { 
      jniLibs.srcDir 'build/jniLibs' 
     } 
    } 

    dexOptions { 
     javaMaxHeapSize "4g" 
    } 

    dataBinding { 
     enabled = true 
    } 
} 

task copyNativeLibs(type: Copy) { 
    from(new File(buildDir, 'intermediates/exploded-aar/')) { 
     include '**/*.so' 
     exclude '**/lib-detector.so' 
    } 
    into new File(buildDir, 'jniLibs') 
    eachFile { details -> 
     def pathSplit = details.path.split('/') 
     details.path = pathSplit[pathSplit.length - 2] + '/' + pathSplit[pathSplit.length - 1] 
    } 

    includeEmptyDirs = false 
} 

tasks.withType(JavaCompile) { javaCompileTask -> javaCompileTask.dependsOn copyNativeLibs } 

clean.dependsOn 'cleanCopyNativeLibs' 

dependencies { 
    testCompile 'junit:junit:4.11' 
    testCompile 'org.robolectric:robolectric:3.0' 
    testCompile 'org.robolectric:shadows-multidex:3.0' 
    testCompile('org.robolectric:shadows-httpclient:3.0') { 
     exclude module: 'httpcore' 
     exclude module: 'commons-codec' 
    } 
    testCompile 'org.powermock:powermock-module-junit4:1.5.2' 
    testCompile 'org.powermock:powermock-api-mockito:1.5.2' 
    testCompile 'org.roboguice:roboguice:3.0.1' 

    compile 'com.parse.bolts:bolts-android:1.2.1' 
    compile fileTree(dir: 'libs', include: 'Parse-*.jar') 

    compile 'com.google.android.gms:play-services-drive:7.8.0' 
    compile 'com.squareup.retrofit:retrofit:1.9.0' 
    compile 'com.android.support:multidex:1.0.1' 
    compile 'com.android.support:support-annotations:23.0.1' 
    compile 'com.android.support:support-v4:23.0.1' 
    compile 'com.android.support:appcompat-v7:23.0.1' 
    compile 'com.android.support:recyclerview-v7:23.0.1' 
    compile 'com.android.support:design:23.0.1' 
    compile 'org.roboguice:roboguice:3.0.1' 
    provided 'org.roboguice:roboblender:3.0.1' 
    compile('com.google.inject.extensions:guice-assistedinject:3.0') { 
     exclude group: 'com.google.inject', module: 'guice' 
    } 
    compile 'commons-io:commons-io:2.4' 
    compile 'commons-lang:commons-lang:2.6' 
    compile 'com.intellij:annotations:12.0' 

    compile 'com.google.zxing:core:3.2.1' 
    compile 'com.google.zxing:android-core:3.2.1' 
    compile 'com.google.android.gms:play-services-base:7.8.0' 
    compile 'com.google.android.gms:play-services-location:7.8.0' 
    compile 'com.google.android.gms:play-services-maps:7.8.0' 
    compile 'com.google.android.gms:play-services-analytics:7.8.0' 
    compile 'com.amazon:in-app-purchasing:2.0.1' 

    compile 'com.googlecode.libphonenumber:libphonenumber:7.0.7' 

    withLeakCanaryCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1' 

    compile 'com.google.android.gms:play-services-ads:7.8.0' 

    compile 'io.reactivex:rxandroid:1.0.1' 
    compile 'io.reactivex:rxjava:1.0.14' 
} 

Frage

Hat jemand anderes hatte das gleiche Problem? Wie man es repariert? Wenn Sie zusätzliche Informationen benötigen, lassen Sie es mich bitte in Kommentaren wissen.

+0

Können Sie Ihre volle 'build.gradle' einmal posten? Ich denke, es hat nichts mit RetroLambda zu tun. –

+0

Danke für die Antwort siehe [hier] (http://grepcode.com/file/repo1.maven.org/maven2/com.google.guava/guava/11.0.2/com/google/common/base/Strings. java # Strings.isNullOrEmpty% 28java.lang.String% 29) 'isNullOrEmpty()' Methode gehört zu 'com.google.guava', und häufig eingecheckt in [Gradle] (https: // github.com/Gradle/Gradle/Suche? utf8 =% E2% 9C% 93 & q = istNullOrEmpty & type = Code) Und ich habe das nicht in Ihrer Größe gesehen. Ich bin auch verwirrt, weil ich nicht auf dieses Problem gestoßen bin, obwohl ich die gleiche Spezifikation wie deine gemacht habe. –

+0

Was passiert, wenn Sie zuerst die Abhängigkeit von Guava hinzufügen Durch die Kompilierung der Gruppe 'compile group: 'com.google.guava', Name: 'guava', Version: '18 .0'' in Abhängigkeit? –

Antwort

1

Haben Sie den neuen Patch auf jitpack von simular Ausgabe # 134 clean-build versuchte, schien es etwas falsch mit gradle Import zu bestellen Sie es mit versuchen:

repositories { 
    maven { url "https://jitpack.io" } 
} 
dependencies { 
    classpath 'com.github.denis-itskovich:gradle-retrolambda:3.2.3-fix-134' 
} 
+0

Damit habe ich 2 Buildfehler bekommen. Einer ist immer noch derselbe, der andere kommt von RetroLambda: 'Kann keine Eigenschaft 'allJava' auf Null-Objekt bekommen. –

0

Es sieht aus wie ein dort ist Fehler mit einem Plugin nach dem Upgrade von Android Studio.

Wenn Sie gehen in: <Android Studio Dir>/plugins/android/lib/builder-model-x.x.x.jar können Sie 2 .jars finden. Versuchen Sie, die alte Version .jar zu löschen und die neue zu behalten und das Projekt zu säubern und neu aufzubauen.

wenn die oben nicht dies funktioniert versuchen:

Ändern Sie die Version von Objectify Bibliothek in der build.gradle Datei Ihres Backend 4.0b auf 5.0.3 oder höher, wenn es vorhanden ist.

Dies klingt vielleicht irrelevant, aber objektiv 4.0b Bibliothek hat gleiche Klassen mit dem gleichen Paketnamen, die in appengine sdk wie com.google.common.base.Strings.isNullOrEmpty vorhanden sind.

Wenn Sie das App-Backend bereitstellen, werden die appengine-Klassen durch objectify-Klassen überschrieben. Wenn Sie also versuchen, eine Methode aufzurufen, wird ein Fehler ausgegeben.

Dies ist in objektivieren 5,0 gelöst. +

Hoffe, es hilft, wie es mir um dieses Problem zu lösen half.

+0

Es sind keine IDEs auf dem Rechner installiert. Objectify wird ebenfalls nicht verwendet (das Großprojekt enthält nur den App-Client). –