问题
iam building my application i got this error
Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (com.amazonaws.javax.xml.stream.xerces.util.SecuritySupport12$4) 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.
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
回答1:
Check the build path -> Java Build Path -> Order and Export tab -> uncheck Android private Librairies.
If it is still not working, add the following line : dex.force.jumbo=true
to the project.properties
file.
The probable cause is maybe a big sized jar in build path.
Edit : This is deprecated because Eclipse is no longer supported by Google, if you wanna get rid of these annoying problems : use Android Studio and enable Multidex.
回答2:
Driss Bounouar solution actually help you in building up your project, but your application may crash at some places after implementing it, I think it actually suppresses the issue at compile time.
The errors I was getting at console were :-
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.
According to this Trace I had tried recompiling my all the projects with same and latest compiler but still I was not getting any success.
Later on replacing latest google Play services with the older one fixed my issue.
I had updated my google play services few hours before and started getting this error there after.
EDIT
To understand the actual problem you should look at Building Apps with Over 65K Methods In our situation it looks like old google Play services had lesser number of methods and hence the project was successfully compiling.
Brief
Our whole project is compiled into one dex file which has limit of 65K methods. But now you can enable multidex files in you project. The solution available so far will work only with GRADLE (Android Studio), I haven't found any way to make it work on Eclipse.
回答3:
I just found an alternative to solve this issue on Eclipse when using Google Play Services. Because on Eclipse it seems that there is no way to use multidex as in Android Studio (and Gradle) this seems the only way to work on Eclipse rigth now.
- go in the google-play-service-lib project
- go in libs
- unzip the file google-play-services.jar
- go in the the unzipped folder and remove all folders that you don't need (i.e. if you need Analytics, you can remove ads, games, maps, wallet, drive, etc.)
- zip again such a folder (that now contains only the needed libraries) together with the MANIFEST folder
- use such new jar with your project.
回答4:
Expirienced same issue. Problem was in google-play-services_lib project. It includes to many functions. This issue is fixed in 21 and newer versions of google-play-services_lib.
To fix multi-dex problem you should remove old lib project completely and use google-play-services_lib_v_21 or newer instead.
For example i used this one: google-play-services.
P.S. Also keep in mind that official google play setup docs say:
You should be referencing a copy of the library that you copied to your development workspace — you should NOT reference the library directly from the Android SDK directory.
回答5:
I also had recently update the google play libs to version 29 and my app hit the 2^16 limit! I downgraded to version 26 that I knew it worked for me and indeed it has.
Developing with Eclipse seems to have become rather unstable now, so it is very advisable to keep track of all the versions of all packages installed!
The solution in the long term is to switch to Android Studio.
回答6:
You get this error mainly because there is a limitation on dalvik executable files and apparently the limit is 65536 which is 2^16.
You have to enable multi-dex configuration for your android application. To enable multi-dex, follow these steps:
Edit your build.gradle file of your main module (app)
android { defaultConfig { ... multiDexEnabled true } } dependencies { ... compile 'com.android.support:multidex:1.0.1' }
Tell your application class to handle these changes.
You can edit your custom application class to enable multi-dex support.
public class MyApplication extends Application { @Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); MultiDex.install(this); } }
OR
public class MyApplication extends MultiDexApplication{ }
OR
Edit your AndroidManifest.xml file to apply your changes to the application tag
<?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>
There are limitation below API Level 14 and below. Your app may not compile or run below API level 14. While compiling you can get OutOfMemory exception. To resolve this, add the following to build.gradle
dexOptions {
jumboMode true
javaMaxHeapSize "4g"
}
来源:https://stackoverflow.com/questions/25928392/dex-loader-unable-to-execute-dex-method-id-not-in-0-0xffff-65536