1

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?

Codes
  • 195
  • 1
  • 5
  • 15
  • Solution here -> http://stackoverflow.com/questions/41133317/javafxports-android-gradle-task-requires-android-support-library-which-is-re – Jason Amade Dec 25 '16 at 15:25

1 Answers1

5

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:

  1. Follow the instructions for adding a support library with resources, using <sdk>/extras/android/support/multidex/library/

  2. Copy the <sdk>/extras/android/support/multidex/library/libs/android-support-multidex.jar JAR into your project's libs/ 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:

Android Support Package Directory Structure

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Under the /support/ directory, the /multidex/ directory does not exist. I cannot copy the mulidex.jar file into my project. Nor can I import the multidex library into my workspace. Maybe I am misunderstanding your answer? – Codes Jan 12 '15 at 21:42
  • @Codes: Then there is something wrong with your installation. It's certainly there at `/extras/android/support/multidex/` on my machine, and that's where the documentation says it should be. I have updated the answer with a screenshot. – CommonsWare Jan 12 '15 at 21:52
  • Yes there is. Do you know how I might download and install the Support Library? – Codes Jan 12 '15 at 22:02
  • @Codes: ::shrug:: I haven't run into this personally. If I were in your shoes, I would first uninstall the Android Support Library entry in the SDK Manager, then would clear the SDK Manager's cache (Tools > Options > Clear Cache), then would reload the SDK Manager's catalog (Packages > Reload), then would try installing the Android Support Library again. I have no idea if that would help, but it's what I would try first. Then, I'd rummage through the Interwebs with a search engine in hopes that somebody wrote up how to fix this. :-) – CommonsWare Jan 12 '15 at 22:13
  • Clearing cache and reloading worked! I found the multidex folder, however when I added the jar to my project I still get the same dex error `Unable to execute dex: method ID not in [0, 0xffff]: 65536` – Codes Jan 13 '15 at 20:18
  • @Codes: If you have `android:name="android.support.multidex.MultiDexApplication"` for ``, then I do not know where your `attachBaseContext()` stuff would be. The `attachBaseContext()` bit is for where you cannot use or inherit from `MultiDexApplication`, as I read the docs. And you're going to have to do something in your build process to be the equivalent of `multiDexEnabled true` in `build.gradle`. But, beyond that, I have not used MultiDex, and so you may wish to ask a separate Stack Overflow question, where you show what you tried. – CommonsWare Jan 13 '15 at 20:24
  • @Codes: Preliminary indications are that you can't use Eclipse for MultiDex builds, though *maybe* you can use Ant: http://stackoverflow.com/a/27211661/115145. – CommonsWare Jan 13 '15 at 20:26