简体   繁体   English

转换为Dalvik格式失败,错误1-

[英]Conversion to Dalvik format failed with error 1 -

When I tried to export signed apk in eclipse, I started getting an error: 当我尝试在Eclipse中导出带符号的APK时,我开始收到错误消息:

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. 我从构建路径中删除了库,并将它们也放入了项目树的libs文件夹中。 Please help. 请帮忙。

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″. 每个月左右,在导出Android应用程序以获取apk文件时,我都会看到一条奇怪的消息:“转换为Dalvik格式失败,错误代码为1”。

follow the following Steps ,it will solve your problem. 请按照以下步骤操作,它将解决您的问题。

This is a JAR file conflict. 这是一个JAR文件冲突。

It seems that You have two JAR files on my buildpath that include the same package and classes. 看来您的buildpath上有两个JAR文件,其中包含相同的包和类。

smack.jar and android_maps_lib-1.0.2 smack.jar和android_maps_lib-1.0.2

Deleting this package from one of the JAR files solved the problem. 从一个JAR文件中删除此程序包解决了该问题。

This is come due to conflict in jar. 这是由于罐子中的冲突引起的。 Try to re-import and change project.properties to this code. 尝试重新导入并将project.properties更改为此代码。

Step 1. Clean project 步骤1.清理项目

Step 2. Remove all jars 步骤2.取出所有罐子

Step 3. Edit project.properties 步骤3.编辑project.properties

Step 4. Refresh project. 步骤4.刷新项目。

Step 5. Run - Export signed apk 步骤5.运行-导出签名的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.**

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM