Я получаю ниже ошибок сборки, когда запускаю приложение в Android Studio 2. Эти ошибки не были там, когда я использовал более раннюю версию Android Studio.
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.
Каковы эти ошибки и как их разрешать? Кроме того, apk строит отлично, и приложение также работает отлично.
Это зафиксировано в LeakCanary 1.4, поэтому простое обновление должно исправить его, не требуя обмена с альтернативной версией haha
.
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.4'
Эти предупреждения вызваны haha:2.0.2
, который является зависимостью leakcanary-android:1.4-beta2
.
Это исправлено в haha:2.0.3
, поэтому вы можете исправить это, явно используя новую версию в ваших зависимостях. Добавьте эту строку для каждого аромата, где вы добавляете зависимость от leakcanary
. Вам не нужно добавлять его в leakcanary-android-no-op
, поскольку он не имеет зависимостей.
debugCompile 'com.squareup.haha:haha:2.0.3'
Добавление
-keepattributes EnclosingMethod
Для файла конфигурации proguard (в моем случае, proguard.cfg
), похоже, исправлено это.
У меня была такая же ошибка. Кажется, что была проблема с утечкой (в моем случае). Я пробовал следующие изменения в файле proguard.
-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
Я больше не получаю эту проблему. Вот ссылка
Я решил проблему, добавив следующую зависимость к моему build.gradle:
TestCompile "com.squareup.leakcanary: leakcanary-android-no-op: 1.4-beta2"
Здесь ссылка: https://github.com/square/leakcanary/issues/491