天天看點

解決“com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536”問題(l轉)

同時在工程中引入了多個第三方jar包,導緻調用的方法數超過了android設定的65536個(DEX 64K problem),進而導緻dex無法生成,也就無法生成APK檔案。

解決辦法如下:

1、谷歌官方已經給出了相關的文檔,參照網上搜尋的資料,首先,我的問題是:

<a></a>

2、在項目的build.gradle檔案的dependencies 節中添加分包設定:

3、通過在defaultConfig節中設定multiDexEnabled标簽為true,開啟multi-dexing支援.

4、分三種情況,由于我并未建立自己的Application.class,直接在AndroidManifest.xml檔案的Application聲明中添加;

5、重新build,生成簽名APK,安裝使用正常。

以上步驟均參考下面連結操作,關于第4步的另外兩種情況,在下面連結中均有詳細說明:

<a href="http://stackoverflow.com/questions/27377080/after-update-of-as-to-1-0-getting-method-id-not-in-0-0xffff-65536-error-i" target="_blank">http://stackoverflow.com/questions/27377080/after-update-of-as-to-1-0-getting-method-id-not-in-0-0xffff-65536-error-i</a>

本文轉自 netcorner 部落格園部落格,原文連結: http://www.cnblogs.com/netcorner/p/5701329.html  ,如需轉載請自行聯系原作者

繼續閱讀