获取"EnclosingMethod"在Android Studio 2中进行构建时出错 [英] Getting "EnclosingMethod" errors on building in Android Studio 2

查看:111
本文介绍了获取"EnclosingMethod"在Android Studio 2中进行构建时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在Android Studio 2中运行该应用程序时,我遇到了构建错误.这些错误在我使用早期版本的Android Studio时不存在.

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.

这些错误是什么以及如何解决它们?另外,apk可以正常运行,并且该应用程序也可以完美运行.

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

推荐答案

更新2016/09/19

此问题已在LeakCanary 1.4中修复,因此只需升级即可解决此问题,而无需弄乱haha的备用版本.

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

以前

这些警告是由haha:2.0.2引起的,而haha:2.0.2leakcanary-android:1.4-beta2的依赖项.

Previously

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

它已在haha:2.0.3中修复,因此您可以通过在依赖项中显式使用较新的版本来对其进行修复.对于要添加leakcanary依赖项的每种口味,请添加此行.您无需为leakcanary-android-no-op添加它,因为它没有依赖性.

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'

这篇关于获取"EnclosingMethod"在Android Studio 2中进行构建时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆