修改
这是由旧的Proguard版本(4.7)引起的。用5.2
不再发生我使用Proguard(在eclipse中)来优化和混淆我的Android项目,但发生了一些奇怪的事情。当我将 -optimizationpasses 设置为1或2时,它可以,但是当我设置为3或更高时,我收到此错误:
转换为Dalvik格式失败,错误1
在Eclipse的错误日志视图中,我发现条目&转换为Dalvik格式失败,错误1':它包含此堆栈跟踪
org.eclipse.core.runtime.CoreException: Conversion to Dalvik format failed with error 1
at com.android.ide.eclipse.adt.internal.project.ExportHelper.exportReleaseApk(ExportHelper.java:317)
at com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard.doExport(ExportWizard.java:313)
at com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard.access$0(ExportWizard.java:238)
at com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard$1.run(ExportWizard.java:223)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:119)
Caused by: com.android.ide.eclipse.adt.internal.build.DexException: Conversion to Dalvik format failed with error 1
at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:825)
at com.android.ide.eclipse.adt.internal.project.ExportHelper.exportReleaseApk(ExportHelper.java:274)
at com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard.doExport(ExportWizard.java:313)
at com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard.access$0(ExportWizard.java:238)
at com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard$1.run(ExportWizard.java:223)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:119)
以下是有关优化的Proguard配置摘录:
-optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*
#-optimizationpasses 3 or above -> exception
-optimizationpasses 2
#-allowaccessmodification
-dontpreverify
问题:
感谢您的帮助
答案 0 :(得分:1)
请更新至Proguard的最新版本,即4.7至5.2
这应解决问题。