Android dex加载程序无法执行dex:method ID不在[0,0xffff]:65536中

Android dex加载程序无法执行dex:method ID不在[0,0xffff]:65536中,android,eclipse,dalvik,Android,Eclipse,Dalvik,我正在构建我的应用程序我遇到了这个错误 Dx警告:忽略匿名内部类的InnerClasses属性 (com.amazonaws.javax.xml.stream.xerces.util.SecuritySupport12$4)没有附带 关联的EnclosingMethod属性。这个类可能是由一个 未以现代.class文件格式为目标的编译器。推荐的 解决方案是使用最新的编译器从源代码重新编译该类 并且不指定任何“-target”类型选项。忽视的后果 此警告表示此类上的反射操作将不正确 指示它不是内部

我正在构建我的应用程序我遇到了这个错误

Dx警告:忽略匿名内部类的InnerClasses属性 (com.amazonaws.javax.xml.stream.xerces.util.SecuritySupport12$4)没有附带 关联的EnclosingMethod属性。这个类可能是由一个 未以现代.class文件格式为目标的编译器。推荐的 解决方案是使用最新的编译器从源代码重新编译该类 并且不指定任何“-target”类型选项。忽视的后果 此警告表示此类上的反射操作将不正确 指示它不是内部类

Dex Loader]无法执行Dex:method ID不在[0,0xffff]:65536中
转换为Dalvik格式失败:无法执行dex:method ID不在[0,0xffff]:65536

检查构建路径->Java构建路径->订单和导出选项卡->取消选中Android私有库

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

可能的原因是构建路径中有一个较大的jar

编辑:
这是不推荐的,因为如果你想摆脱这些恼人的问题,Eclipse不再受Google支持:使用Android Studio并启用Multidex。

Driss 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.
根据这条线索,我曾尝试用同一个最新的编译器重新编译我的所有项目,但仍然没有获得任何成功

后来用旧的替换最新的google Play服务解决了我的问题

我在几小时前更新了我的谷歌游戏服务,之后就开始出现这个错误

编辑

要了解实际问题,您应该看看在我们的情况下,旧的google Play服务的方法数量似乎较少,因此项目成功编译

简介

我们的整个项目被编译成一个dex文件,该文件有65K个方法的限制。但现在您可以在项目中启用多索引文件。
到目前为止,可用的解决方案只适用于GRADLE(Android Studio),我还没有找到任何方法使其在Eclipse上工作。

同样的问题。问题出在google-play-services_lib项目中。 它包括许多功能。此问题已在21及更新版本的中修复 google-play-services_lib

要解决多索引问题,您应该完全删除旧的lib项目并使用 google-play-services_lib_v_21或更新版本

例如,我使用了这个:

另请记住,官员说:

您应该引用复制到开发工作区的库的副本-不应该直接从Android SDK目录引用库


我刚刚在Eclipse上找到了一个解决这个问题的替代方法,即使用Google Play服务。 因为在Eclipse上似乎没有办法像在Android Studio(和Gradle)中那样使用multidex,这似乎是现在在Eclipse rigth上工作的唯一方法

  • 进入google play服务库项目
  • 自由发挥
  • 解压缩文件google-play-services.jar
  • 进入解压文件夹并删除所有您不需要的文件夹(即,如果您需要分析,您可以删除广告、游戏、地图、钱包、驱动器等)
  • 将这样的文件夹(现在只包含所需的库)与清单文件夹一起再次压缩
  • 在项目中使用这样的新jar

  • 我最近还将google play libs更新为29版,我的应用程序达到了2^16的极限!我降级到26版,因为我知道它对我有用,而且确实如此

    使用Eclipse进行开发现在似乎变得相当不稳定,因此最好跟踪所有安装包的所有版本


    从长远来看,解决方案是切换到Android Studio。

    出现此错误主要是因为dalvik可执行文件有一个限制,显然限制是65536,即2^16

    您必须为android应用程序启用多索引配置。 要启用多索引,请执行以下步骤:

  • 编辑主模块(应用程序)的build.gradle文件

  • 告诉您的应用程序类处理这些更改

    您可以编辑自定义应用程序类以启用多索引支持

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

    编辑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>
    

    在我的例子中,取消选中私有库是解决问题的方法。^我不这么认为,取消选中会在运行时出现“未找到x类”的错误……Eclipse是如此混乱,以至于每次都是一些奇怪的技巧使它工作。当然,它不会工作,请切换回库选项卡(订单左侧和导出选项卡),扩展Android私有库,看看您的APK将缺少什么。建议的第一部分(取消选中Android私有库)对任何新的Eclipse用户来说都是非常无用和混乱的。这不是Eclipse问题,而是Android设计问题和Android开发者工具的局限性。对于那些仍然坚持使用Eclipse的人来说,这是一个完美的答案。这是为我的一位同事解决的问题,他更新了服务,项目停止了工作,出现了所描述的错误。这并不总是一个损坏的类,有时是项目库的大小,但您所说的是有效的,可以真正为您解决问题+1。。他要求解决方案,所以我给出了第一个解决方案。嗨,我仍然面临着新版本的play服务的这个问题。我能做点什么吗?谢谢
    public class MyApplication extends MultiDexApplication{
    
    }
    
    <?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>
    
    dexOptions {
        jumboMode true
        javaMaxHeapSize "4g"
    }