问题
I have exceeded the 65k method limit, by importing an external library. I have enabled ProGuard, but still get the same error.
[2015-01-12 15:13:39 - Dex Loader] Unable to execute dex: method ID not in [0, 0xffff]: 65536
[2015-01-12 15:13:39 - MyFirstGame] Conversion to Dalvik format failed: Unable to execute dex: method ID not in [0, 0xffff]: 65536
After reading the official Google documentation, it seems I should configure a MultiDex support. I am building my project using the Eclipse Indigo IDE, and do not have a build.gradle file. Using the SDK Manager I have installed 'Android Support Repository' Rev. 11 and 'Android Support Library' Rev. 21.0.3. I have added the
android:name="android.support.multidex.MultiDexApplication"
attribute to my manifest file, and am now trying to implement
@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(newBase);
MultiDex.install(this);
}
However, the 'MultiDex' class cannot be resolved. According to the Official Google Documentation, this jar should be located /extras/android/support/multidex/ There is no /multidex/ directory under the /support/ directory.
How might I download and install the MulitDex Support Library?
回答1:
Using the SDK Manager I have installed 'Android Support Repository' Rev. 11
That is for developers using Android Studio or other tools that use Gradle for Android. Its contents will not be presently used by standard Eclipse.
According to the Official Google Documentation, this jar should be located /extras/android/support/multidex/
Try one of these:
Follow the instructions for adding a support library with resources, using
<sdk>/extras/android/support/multidex/library/
Copy the
<sdk>/extras/android/support/multidex/library/libs/android-support-multidex.jar
JAR into your project'slibs/
directory (since the aforementioned Android library project seems to only contain this JAR and nothing else)
Do not do both. Do one or the other.
UPDATE
Here is a screenshot of my <sdk>/extras/android/support/
, showing multidex/
right where the docs say it should be:
来源:https://stackoverflow.com/questions/27910824/android-multidex-install