2014-09-19 90 views
11

IAM構建我的應用程序得到這個錯誤DEX裝載機無法執行DEX:不是在方法ID [0,爲0xFFFF]:65536

DX警告:忽略InnerClasses爲匿名內部類 (com.amazonaws屬性。 javax.xml.stream.xerces.util.SecuritySupport12 $ 4),但不包含 關聯的EnclosingMethod屬性。這個類可能是由一個 編譯器生成的,它不針對現代.class文件格式。建議的 解決方案是使用最新的編譯器 並且不指定任何「-target」類型選項,從源代碼重新編譯該類。忽略 這個警告的結果是,對這個類的反射操作將錯誤地 指示它是而不是的一個內部類。

塞米鬆裝載機]無法執行DEX:未在[0方法ID,爲0xFFFF]:65536 轉換到的Dalvik格式失敗:無法執行DEX:未在[0方法ID,爲0xFFFF]:65536

+0

的可能的複製[無法執行DEX:不\ [0,爲0xFFFF \]方法ID:65536](http://stackoverflow.com/questions/15209831 /無法執行dex-method-id-not-in-0-0xffff-65536) – bummi 2016-03-14 08:32:44

回答

54

檢查構建路徑 - > Java構建路徑 - >訂單和導出選項卡 - >取消選中Android專用Librairies。

如果仍不起作用,請將以下行:dex.force.jumbo=true添加到project.properties文件。

可能的原因可能是構建路徑中的大型jar。

編輯: 這是推薦使用,因爲Eclipse中不再受谷歌的支持,如果你想擺脫這些惱人的問題:使用Android Studio和啓用Multidex。

+12

取消選中私有庫是我的情況下的修復程序 – DeltaCap 2014-11-07 16:24:28

+13

^我不這麼認爲,取消選中會在運行時給出錯誤那'class x not found'.. – Farhan 2015-04-24 10:46:17

+2

好吧,Eclipse是如此的混亂,每次它是一個奇怪的技巧,使它的工作。 – 2015-04-24 11:37:54

11

德里斯Bounouar解決方案真正幫助你建立你的項目,但您的應用程序可以實現它之後的一些地方崩潰,我認爲它實際上在編譯時抑制問題。

的錯誤,我漸漸在控制檯是: -

Dex Loader] Unable to execute dex: method ID not in [0, 0xffff]: 65536 
Conversion to Dalvik format failed: Unable to execute dex: method ID not in [0, 0xffff]: 65536 

[2014-11-08 15:51:58 - MLBPA] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class 
(jnamed$1) that doesn't come with an 
associated EnclosingMethod attribute. This class was probably produced by a 
compiler that did not target the modern .class file format. The recommended 
solution is to recompile the class from source, using an up-to-date compiler 
and without specifying any "-target" type options. The consequence of ignoring 
this warning is that reflective operations on this class will incorrectly 
indicate that it is *not* an inner class. 
[2014-11-08 15:51:58 - MLBPA] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class 
(jnamed$2) that doesn't come with an 
associated EnclosingMethod attribute. This class was probably produced by a 
compiler that did not target the modern .class file format. The recommended 
solution is to recompile the class from source, using an up-to-date compiler 
and without specifying any "-target" type options. The consequence of ignoring 
this warning is that reflective operations on this class will incorrectly 
indicate that it is *not* an inner class. 
[2014-11-08 15:51:58 - MLBPA] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class 
(jnamed$3) that doesn't come with an 
associated EnclosingMethod attribute. This class was probably produced by a 
compiler that did not target the modern .class file format. The recommended 
solution is to recompile the class from source, using an up-to-date compiler 
and without specifying any "-target" type options. The consequence of ignoring 
this warning is that reflective operations on this class will incorrectly 
indicate that it is *not* an inner class. 
[2014-11-08 15:51:59 - MLBPA] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class 
(org.xbill.DNS.UDPClient$1) that doesn't come with an 
associated EnclosingMethod attribute. This class was probably produced by a 
compiler that did not target the modern .class file format. The recommended 
solution is to recompile the class from source, using an up-to-date compiler 
and without specifying any "-target" type options. The consequence of ignoring 
this warning is that reflective operations on this class will incorrectly 
indicate that it is *not* an inner class. 

根據這個跟蹤我曾試圖重新編譯我的所有項目相同,最新的編譯器,但我仍然沒有得到任何成功。

後來與舊的一個更換最新谷歌Play業務固定我的問題。

我已經更新了我的谷歌播放服務幾個小時前,並開始得到這個錯誤後。

編輯

要了解你應該看看Building Apps with Over 65K Methods在我們的情況下,它看起來像老谷歌Play業務有較少數量的方法,因此該項目已成功編制的實際問題。

簡要

我們整個項目被編譯成具有65K方法限制一個DEX文件。但是現在你可以在你的項目中啓用multidex文件。 到目前爲止可用的解決方案只能用於GRADLE(Android Studio),我還沒有找到任何方式使它在Eclipse上工作。

+1

這一個解決了它爲我的一個同事,他已經更新的服務和項目停止工作的錯誤描述 – Marc 2014-11-13 12:37:01

+1

它並不總是一個腐敗的類有時它是項目庫的大小,但你說的是有效的解決這個問題,真正爲你+ 1 ..他要求解決方案,所以我提出了第一個解決方案。 – 2014-11-14 10:04:18

4

Expirienced same issue。問題出現在google-play-services_lib項目中。它包含許多功能。此問題已在21和更新版本的 google-play-services_lib中修復。

要解決多DEX的問題,您應該完全刪除舊的lib項目和使用 谷歌播放,services_lib_v_21或更新版本來代替。

例如我用這個:google-play-services

P.S.也請記住,官方google play setup docs說:

你應該是引用複製到您的開發工作區的庫的副本 - 你不應該從Android SDK的目錄直接引用庫。

+2

嗨,我仍然遇到這個問題與新版本的播放服務。有什麼我可以做的嗎? – 2015-05-21 06:29:18

+0

非常感謝。我用你的21個庫,它解決了我的問題。非常感謝你。長時間:) – 2015-07-06 09:50:48

8

我剛剛在使用Google Play服務時找到了一個在Eclipse上解決此問題的替代方法。 因爲在Eclipse上,似乎沒有辦法像Android Studio(和Gradle)那樣使用multidex,這似乎是現在在Eclipse上工作的唯一方法。

  1. 走在谷歌播放服務-lib的項目
  2. 去庫
  3. 解壓縮文件,谷歌,播放services.jar
  4. 走在解壓後的文件夾,刪除所有文件夾的是你不需要(即如果你需要分析,你可以刪除廣告,遊戲,地圖,錢包,驅動器等)
  5. 再次壓縮這樣一個文件夾(現在只包含所需的庫)和MANIFEST文件夾
  6. 在您的項目中使用這樣的新罐子。
+1

這是一個安全和簡單的解決方法。 – Peter 2016-02-05 19:41:04

+1

好主意,謝謝你分享 – Don 2016-03-09 09:48:53

+0

它的工作,但mapfragment不工作對我來說@ ugo你可以告訴我的問題的任何解決方案 – 2016-03-28 07:55:45

0

我也有最近更新谷歌播放庫版本29和我的應用程序達到2^16限制!我降級到了26版本,我知道它爲我工作,事實上它已經。

用Eclipse進行開發現在似乎變得相當不穩定,所以最好跟蹤所有已安裝軟件包的所有版本!

從長遠來看,解決方案是切換到Android Studio。

0

你得到這個錯誤主要是因爲在dalvik可執行文件上有一個限制,顯然限制是65536這是2^16。

您必須爲您的android應用程序啓用multi-dex配置。 要啓用多DEX,請按照下列步驟操作:在主模塊的

  1. 編輯您的build.gradle文件(應用程序)

    android { 
        defaultConfig { 
        ... 
        multiDexEnabled true 
    } 
    } 
    
    dependencies { 
        ... 
        compile 'com.android.support:multidex:1.0.1' 
    } 
    
  2. 告訴你的應用程序類來處理這些變化。

    您可以編輯自定義應用程序類以啓用multi-dex支持。

    public class MyApplication extends Application { 
    
    @Override 
    protected void attachBaseContext(Context base) { 
        super.attachBaseContext(base); 
        MultiDex.install(this); 
    } 
    } 
    

    OR

    public class MyApplication extends MultiDexApplication{ 
    
    } 
    

    OR

    編輯您的AndroidManifest.xml文件將更改應用到應用程序標籤

    <?xml version="1.0" encoding="utf-8"?>   
    <manifestxmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.example.android.multidex.myapplication"> 
        <application 
        ... 
        android:name="android.support.multidex.MultiDexApplication"> 
        ... 
        </application> 
    

API級別14及以下有限制。您的應用程序可能無法在API級別14以下編譯或運行。編譯期間,您可能會遇到OutOfMemory異常。解決這個問題,添加以下的build.gradle

dexOptions { 
    jumboMode true 
    javaMaxHeapSize "4g" 
} 
相關問題