2016-04-21 11 views
30

Ich erhalte unterhalb Build-Fehler, wenn ich die App in Android Studio 2 ausführen. Diese Fehler waren nicht vorhanden, wenn ich frühere Version von Android Studio verwendete."EnclosingMethod" -Fehler beim Erstellen in Android Studio 2 erhalten

Error:warning: Ignoring InnerClasses attribute for an anonymous inner class 
Error:(com.squareup.haha.guava.base.Joiner$1) that doesn't come with an 
Error:associated EnclosingMethod attribute. This class was probably produced by a 
Error:compiler that did not target the modern .class file format. The recommended 
Error:solution is to recompile the class from source, using an up-to-date compiler 
Error:and without specifying any "-target" type options. The consequence of ignoring 
Error:this warning is that reflective operations on this class will incorrectly 
Error:indicate that it is *not* an inner class. 
Error:warning: Ignoring InnerClasses attribute for an anonymous inner class 
Error:(com.squareup.haha.guava.collect.Iterables$2) that doesn't come with an 
Error:associated EnclosingMethod attribute. This class was probably produced by a 
Error:compiler that did not target the modern .class file format. The recommended 
Error:solution is to recompile the class from source, using an up-to-date compiler 
Error:and without specifying any "-target" type options. The consequence of ignoring 
Error:this warning is that reflective operations on this class will incorrectly 
Error:indicate that it is *not* an inner class. 
Error:warning: Ignoring InnerClasses attribute for an anonymous inner class 
Error:(com.squareup.haha.guava.collect.Iterables$3) that doesn't come with an 
Error:associated EnclosingMethod attribute. This class was probably produced by a 
Error:compiler that did not target the modern .class file format. The recommended 
Error:solution is to recompile the class from source, using an up-to-date compiler 
Error:and without specifying any "-target" type options. The consequence of ignoring 
Error:this warning is that reflective operations on this class will incorrectly 
Error:indicate that it is *not* an inner class. 

Was sind diese Fehler und wie können sie gelöst werden? Außerdem funktioniert die App gut und die App läuft auch perfekt.

+1

hast du versucht sauber-> Umbau – Lokanath

+0

@Lokanath ja, das habe ich schon ausprobiert. –

+0

Sie haben die Lösung von hier, während Sie nach dem Problem suchen: http://StackOverflow.com/a/36523016/1263362 – Sayem

Antwort

5

Ich bekam denselben Fehler. Es scheint, dass es ein Problem mit Leckkanälen gab (in meinem Fall). Ich habe versucht, Änderungen in der Progard-Datei zu ändern.

-dontwarn com.squareup.haha.guava.** 
-dontwarn com.squareup.haha.perflib.** 
-dontwarn com.squareup.haha.trove.** 
-dontwarn com.squareup.leakcanary.** 
-keep class com.squareup.haha.** { *; } 
-keep class com.squareup.leakcanary.** { *; } 

# Marshmallow removed Notification.setLatestEventInfo() 
-dontwarn android.app.Notification 

Ich bekomme dieses Problem nicht mehr. Hier ist die link

30

aktualisieren 2016/09/19

Das in LeakCanary fixiert ist 1,4, so einfach aktualisieren sollte es beheben, ohne sich mit einer alternativen Version von haha herumschlagen müssten.

debugCompile 'com.squareup.leakcanary:leakcanary-android:1.4' 

Zuvor

Diese Warnungen durch haha:2.0.2 verursacht, die eine Abhängigkeit von leakcanary-android:1.4-beta2 ist.

Es ist in haha:2.0.3 behoben, so dass Sie es beheben können, indem Sie explizit die neuere Version in Ihren Abhängigkeiten verwenden. Fügen Sie diese Zeile für jede Variante hinzu, in der Sie eine leakcanary-Abhängigkeit hinzufügen. Sie müssen es nicht für hinzufügen, da es keine Abhängigkeiten hat.

debugCompile 'com.squareup.haha:haha:2.0.3' 
+2

Es ist der einfachste Weg, um diese nervige Warnung loszuwerden. Danke – Oleksandr

15

Hinzufügen

-keepattributes EnclosingMethod

zu proguard der Konfigurationsdatei (in meinem Fall, proguard.cfg) scheint dies behoben zu haben.

+0

Ja, das hat das Problem gelöst. – zygimantus

+0

Funktioniert dies für Debug-Builds? –

+0

Debugbuilds bauen normalerweise nicht mit proguard (weil es so lange dauert, so dass die meisten configs es nicht haben) .. aber ich nehme an es sollte ... – fattire

Verwandte Themen