Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting "EnclosingMethod" errors on building in Android Studio 2

I am getting below build errors when I am running the app in Android Studio 2. These errors were not there when I was using earlier version of 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. 

What are these errors and how to resolve them? Also, the apk is building fine and the app also runs perfectly.

like image 298
Amit Tiwari Avatar asked Apr 21 '16 07:04

Amit Tiwari


1 Answers

Update 2016/09/19

This is fixed in LeakCanary 1.4, so simply upgrading should fix it without needing to mess with an alternate version of haha.

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

Previously

These warnings are caused by haha:2.0.2, which is a dependency of leakcanary-android:1.4-beta2.

It's fixed in haha:2.0.3, so you can fix it by explicitly using the newer version in your dependencies. Add this line for each flavor where you are adding a leakcanary dependency. You don't need to add it for leakcanary-android-no-op, since it has no dependencies.

debugCompile 'com.squareup.haha:haha:2.0.3' 
like image 133
Sky Kelsey Avatar answered Sep 23 '22 18:09

Sky Kelsey