DX糟糕的类文件魔术(cafebabe)或版本(0033.0000)与ADK14魔术、糟糕、版本、文件

2023-09-11 20:33:39 作者:余生敬安凉

自从搬到ADK14,我一直无法建立发布新的apk在我的Windows 7系统。

Since moving to ADK14, I have been unable to build new apks for release on my Windows 7 system.

大厦失败,转换的Dalvik格式失败,错误1,而中控台充满了许多的dx糟糕的类文件魔术(cafebabe)或版本(0033.0000)。

Building fails with "conversion to dalvik format failed with error 1", while the console is filled with lots of "Dx bad class file magic (cafebabe) or version (0033.0000)".

全异常文本:

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:740)
at com.android.ide.eclipse.adt.internal.project.ExportHelper.exportReleaseApk(ExportHelper.java:204)
at com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard.doExport(ExportWizard.java:290)
at com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard.access$0(ExportWizard.java:229)
at com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard$1.run(ExportWizard.java:214)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)

我建立了使用大量的库,所以presumably问题与此相关的事实,一个旧的项目。已经做了所有的修复属性/清洁等被建议转移到ADK14的时候(因为我很自然地把所有这些问题),但他们并没有帮助这一点。

I am building an old project that uses lots of libraries, so presumably the problem is related to this fact. Already done all the "Fix Properties"/Clean etc that are suggested when moving to ADK14 (as I naturally had all those problems), but they haven't helped with this.

所有的图书馆都在同一个Android SDK和JDK / JRE版本,所以这似乎不会是issue.And事实上,应用程序很容易内置调试和安装在我的旧版本1.5的HTC Magic - 只有当我需要导出签名的应用程序包,这打破了。

All the libraries are on the same Android SDK and JDK/JRE version, so this wouldn't seem to be the issue.And in fact, the app is easily built in debug and installed on my old version 1.5 HTC Magic - it is only when I need to export a signed application package that this breaks down.

这是一个Windows 7x64 PC上。我观察到,在包装上的apk我的Linux笔记本电脑(清醒山猫)为完全相同的code任何具有绝对没有问题。

This is on a Windows 7x64 PC. I observe that packing the apk on my Linux laptop (Lucid Lynx) for the exact same code has absolutely no problems whatsoever.

任何想法?变得非常沮丧与此有关。

Any ideas? Getting very frustrated with this.

注意

显然,该错误消息可以由各种不同的问题引起的。我的具体问题是不相关的Java的6/7,因为我从来没有在第一时间安装了Java 7和编译器符合设置为Java 6中(我检查的时候,因为我已经看到了解决方案,其他地方的建议)。

Apparently, this error message can be triggered by a variety of different problems. My particular problem was not related to Java 6/7, as I never installed Java 7 in the first place, and compiler compliance was set to Java 6 (I checked at the time, as I had seen that solution suggested elsewhere).

推荐答案

我找到了解决这个问题的最后。

I found the solution to this problem at last.

如果你看一下Proguard.bat(Android的SDK \工具\ ProGuard的\ BIN),你会发现下面的行:

If you look in Proguard.bat (Android SDK\tools\proguard\bin), you will find the following line:

call %java_exe% -jar "%PROGUARD_HOME%"\lib\proguard.jar %*

使用以下内容替换它:

Replace it with the following:

call %java_exe% -jar "%PROGUARD_HOME%"\lib\proguard.jar %1 %2 %3 %4 %5 %6 %7 %8 %9

这是一个愚蠢的老问题,我居然发现我以前也见过,现在我已经想通了。显然,Android SDK的团队还没有修复这个问题,当我做了一个干净的Andr​​oid SDK的安装被重新提出。

It's a stupid old issue, that I actually realize that I have seen before, now that I have figured it out. Apparently the Android SDK team still haven't fixed this problem, and it was reintroduced when I did a clean install of the Android SDK.