1

When I tried to export signed apk in eclipse, I started getting an error:

Dx Uncaught translation error: com.android.dx.cf.code.SimException: local 0000: invalid
Dx 1 error; aborting
Conversion to Dalvik format failed with error 1

I don't understand, why I am getting this error. I searched it for a long time but I didn't find any useful solution. I'v removed libraries from build path and put them into libs folder of project tree also. Please help.

Anshul Tyagi
  • 2,076
  • 4
  • 34
  • 65
  • Are you using ProGuard or some other obfuscation tool? See http://stackoverflow.com/questions/5701126/compile-with-proguard-gives-exception-local-variable-type-mismatch – Michael Jan 04 '16 at 12:58
  • 1
    Yes, I am using ProGuard. –  Jan 05 '16 at 04:04

2 Answers2

0

Every month or so, while exporting an Android application to get an apk file, I see the mysterious message: “Conversion to Dalvik format failed with error code 1″.

follow the following Steps ,it will solve your problem.

This is a JAR file conflict.

It seems that You have two JAR files on my buildpath that include the same package and classes.

smack.jar and android_maps_lib-1.0.2

Deleting this package from one of the JAR files solved the problem.

Nikhil Singh
  • 300
  • 2
  • 13
  • 1
    You just copy someone's answer and paste there. Try give answer of your own. –  Jan 05 '16 at 04:09
0

This is come due to conflict in jar. Try to re-import and change project.properties to this code.

Step 1. Clean project

Step 2. Remove all jars

Step 3. Edit project.properties

Step 4. Refresh project.

Step 5. Run - Export signed apk

Here is code.

-injars      bin/classes
-injars      libs
-outjars     bin/classes-processed.jar

-dontpreverify
-repackageclasses ''
-allowaccessmodification
-optimizations !code/simplification/arithmetic
-keepattributes *Annotation*

-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.view.View {
    public <init>(android.content.Context);
    public <init>(android.content.Context, android.util.AttributeSet);
    public <init>(android.content.Context, android.util.AttributeSet, int);
    public void set*(...);
}

-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.content.Context {
   public void *(android.view.View);
   public void *(android.view.MenuItem);
}

-keepclassmembers class * implements android.os.Parcelable {
    static ** CREATOR;
}

-keepclassmembers class **.R$* {
    public static <fields>;
}

-keepclassmembers class * {
    @android.webkit.JavascriptInterface <methods>;
} 
 -dontwarn org.apache.http.**
 -dontwarn android.support.v4.app.**
 -dontwarn com.android.volley.**
 -dontwarn com.squareup.picasso.**
 -dontwarn com.activate.gcm.**
 -dontwarn com.google.android.gms.**
EugeneK
  • 100
  • 4
Sanwal Singh
  • 1,765
  • 3
  • 17
  • 35