Android出現方法超過64k的問題

2021-08-27 08:00:46 字數 464 閱讀 7490

手機直接debug本身沒有問題,但是打包的時候會出現unable to execute dex: method id not in[0, 0xffff]: 65536)這種問題導致打包失敗,這是單個dex檔案方法數超過64k導致的,基本上引入過多的依賴都會出現這個問題,解決方法:

1.匯入依賴

'com.android.support:multidex:1.0.1'
2.defaultconfig增加這個設定

multidexenabled true
3.android下面增加這個設定

dexoptions
@override

protected void attachbasecontext

(context base)

android方法數超過64K的解決方案

conversion to dalvik format failed unable to execute dex method id not in 0,0xffff 65536 複製 這就是android中方法數超過64k,即64 1024位數的限制。在android官方api中給出了這個問題的解決...

Android方法數methods超過65536

cannot fit requested classes in a single dex file.try supplying a main dex list.methods 86204 65536 message 原因是android系統定義總方法數是乙個short int,short int 最...

Android方法數methods超過65536

cannot fit requested classes in a single dex file.try supplying a main dex list.methods 86204 65536 message原因是android系統定義總方法數是乙個short int,short int 最大...