Sandeep Singh
Sandeep Singh

Reputation: 1127

Unable to execute dex: method ID not in [0, 0xffff]: 65536 in Eclipse

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 !!

Upvotes: 2

Views: 4252

Answers (2)

manjusg
manjusg

Reputation: 2263

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

Upvotes: 0

andrei
andrei

Reputation: 2940

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

Upvotes: 2

Related Questions