Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
最近安裝項(xiàng)目到自己oppo手機(jī)上提示Error:warning: Ignoring InnerClasses attribute for an anonymous inner class,但是在模擬機(jī)上或者其他手機(jī)都可以的,百度說
方法一
資料顯示每個(gè)項(xiàng)目的Dex都有方法數(shù)的限制(上限65536,超過上限號(hào)稱應(yīng)用爆棚)
?在proguard-rules.pro文件中添加如下代碼(解釋:忽略內(nèi)部類的一些屬性)
proguard-rules.pro在app下面
如下圖
添加
-keepattributes EnclosingMethod 我添加了沒有用
然后繼續(xù)是第二種方法
在app下面的build添加
multiDexEnabled? true
defaultConfig {
minSdkVersion 15
targetSdkVersion 25
versionCode 4
versionName "1.1.0"
multiDexEnabled true
}
添加了還是沒用,繼續(xù)百度
第三種方法
1、在AndroidManifest.xml的application中聲明android.support.multidex.MultiDexApplication;
2、如果你已經(jīng)有自己的Application類,讓其繼承MultiDexApplication;
3、如果你的Application類已經(jīng)繼承自其它類,你不想修改它,那么可以重寫attachBaseContext()方法:
- @Override???
- protected?void?attachBaseContext(Context?base)?{??
- ????super.attachBaseContext(base);
- ?MultiDex.install(this);??
- }?
自己用的3,就是在Application下面添加
@Override protected void attachBaseContext(Context base) {super.attachBaseContext(base); MultiDex.install(this); }這樣問題就處理好了,這個(gè)問題很讓頭疼,
上面三種方法,自己用的第三種方法處理好的,如果你們是發(fā)布項(xiàng)目遇到或者安裝項(xiàng)目到自己手機(jī)遇到這種問題就試試上面三種方法吧,很實(shí)用,都是大家實(shí)踐過的。
總結(jié)
以上是生活随笔為你收集整理的Error:warning: Ignoring InnerClasses attribute for an anonymous inner class的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 比较好听的沙拉名字
- 下一篇: 《卧小斋》是谁的作品?