2

I'm developing an application on Eclipse. In which I need to use the following libraries

1) AppCompact

2) Google Play Services

3) LiveSDK

4) json.jar

When I try to run my project it gave this error.

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

Even I have remove the libraies from Java Buid Path but still I got this error.

I have also used the progaurd but error is not resolved. Here is my progarud file

project.properties

proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=android-22
android.library.reference.1=./workspace2/google-play-services_lib
android.library.reference.2=./workspace2/LiveSdk
android.library.reference.3=./android/workspace2/appcompat_v7

proguard-project.txt

-optimizationpasses 5 -dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -dontpreverify -verbose -optimizations !code/simplification/arithmetic,!field/,!class/merging/

-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService

-keepclasseswithmembernames class * {
    native <methods>;
}

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers class * extends android.app.Activity {
   public void *(android.view.View);
}

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}
-keep class * extends java.util.ListResourceBundle {
    protected Object[][] getContents();
}

-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
    public static final *** NULL;
}

-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
    @com.google.android.gms.common.annotation.KeepName *;
}

-keepnames class * implements android.os.Parcelable {
    public static final ** CREATOR;
}

Help me !!

Sandeep Singh
  • 1,117
  • 2
  • 11
  • 29
  • clear your `yourProject-->bin-->dexedlibs folder` and then remove all `libraries` and then add all the `libraries` again – M D Jul 23 '15 at 11:59
  • @MD still got same error – Sandeep Singh Jul 23 '15 at 12:06
  • Check this link - https://developer.android.com/intl/ru/tools/building/multidex.html – Surender Kumar Jul 23 '15 at 12:32
  • possible duplicate of [Unable to execute dex: method ID not in \[0, 0xffff\]: 65536](http://stackoverflow.com/questions/15209831/unable-to-execute-dex-method-id-not-in-0-0xffff-65536) – JesusFreke Jul 23 '15 at 17:01
  • @JesusFreke, That will not resolved my problem. Answers given on that link far for `AndroidStudio` not for `Eclipse`. – Sandeep Singh Jul 24 '15 at 05:00
  • Yes, the solutions as given in that question are to use multidex or proguard. The choice of IDE doesn't change the fact that these are the 2 options you have for resolving this issue. – JesusFreke Jul 24 '15 at 08:43

2 Answers2

2

You have exceeded the 65k methods limit. So what you want is enable multidex or to have less than 65k methods in your app + libraries.

There is a multidex support library but it is not supported by ant or eclipse. https://plus.google.com/+AndroidDevelopers/posts/HQM7qeosJoF

And you could also load individual Play Services APIs because you probably don't need them all https://developers.google.com/android/guides/setup

but you would still need AS and gradle.

Apparently you can use gradle with eclipse but I never tried it

Is it possible to use the Gradle build system for Android with Eclipse?

My advice is to migrate to Android Studio

Community
  • 1
  • 1
andrei
  • 2,934
  • 2
  • 23
  • 36
0

Your getting this error because your exceeding the 65k limit.
Check https://developer.android.com/tools/building/multidex.html

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
manjusg
  • 2,275
  • 1
  • 22
  • 31
  • I know this. But wants any solution. – Sandeep Singh Jul 23 '15 at 12:29
  • @SandeepSingh Add multidex support to your app. In that link, it shows how to do it. I have done the same in Android studio and it works fine. Not sure on if it's different on eclipse. – manjusg Jul 23 '15 at 12:34