1.gradle编译完后出现了几百个error
特别是Ingoring InnerClasser attribute for an anonymous inner class这个错误,截取错误提示的一部分
Warning:Ignoring InnerClasses attribute for an anonymous inner class
this warning is that reflective operations on this class will incorrectly
Warning:Ignoring InnerClasses attribute for an anonymous inner class
associated EnclosingMethod attribute. This class was probably produced by a
solution is to recompile the class from source, using an up-to-date compiler
compiler that did not target the modern .class file format. The recommended
很验证去判断到底是什么,只知道是complie的时候出问题,排查了一下,发现原因是重复导包
解决办法是:去gradle里面移除重复的jar包
比如我的gradle里面就有
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.facebook.fresco:fresco:0.6.0'
compile 'com.jakewharton:butterknife:7.0.1'
// 下面这个就是重复的包,因为这个包已经在libs文件夹下,而libs文件夹是我们已经在最开始的时候通过compile fileTree导入进来了,所以下面这句需要删除
compile files('libs/umeng-update-v2.6.0.1.jar')
删除了最后一句 compile files(‘libs/umeng-update-v2.6.0.1.jar’)后,真机运行正常。
2.gradle的版本升级问题
每次更新Android Studio,都会提示更新gradle,最好的方式就是科学上网,在Android Studio内更新。实在不行的话,就自己去AndroidDevTools下载相应的gradle,本地更新。