在构建时调试 Unity Android "Unable to convert classes into dex format" 错误

Debugging a Unity Android "Unable to convert classes into dex format" error on build

由于这些 dex 格式错误,我在构建 Unity Android 时遇到了问题。

我查看了人们遇到的类似错误,涉及 Unity 项目中的重复 .jar 文件,但我删除了我能找到的所有罪魁祸首,但这种情况仍在发生。我最近更新了 unity Facebook 插件,项目中还有其他几个插件,所以我知道我很容易有一些重复的文件。

我可以看到很多 "illegal argument exception" 已经添加了翻译错误,所以我假设某些内容被引用了两次,但我无法弄清楚这些 "accessibility service" 文件在哪里。

我承认其余的错误我仍在努力弄清楚。我还不是经验丰富的 java/android 开发人员。

有谁知道哪里出了问题?或者对如何进一步调试此错误有任何想法?

Error building Player: CommandInvokationFailure: Unable to convert classes into dex format. See the Console for details.
/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/bin/java -Xmx2048M -Dcom.android.sdkmanager.toolsdir="/Users/Admin/Public_Library/Android/sdk/tools" -Dfile.encoding=UTF8 -jar "/Applications/Unity/Unity.app/Contents/BuildTargetTools/AndroidPlayer/sdktools.jar" -

stderr[
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoIcsImpl;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoJellyBeanMr2;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoStubImpl;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompatIcs;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompatJellyBeanMr2;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/app/ActionBarDrawerToggle;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/app/ActionBarDrawerToggle;

UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Translation has been interrupted
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:608)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:311)
    at com.android.dx.command.dexer.Main.run(Main.java:277)
    at com.android.dx.command.dexer.Main.main(Main.java:245)
    at com.android.dx.command.Main.main(Main.java:106)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at SDKMain.main(SDKMain.java:130)
Caused by: java.lang.InterruptedException: Too many errors
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:600)
    ... 9 more
]

我错了,看来我的项目中还有一个重复的 .jar 文件。两个不同的社交插件有两个名称不同的 .jar 文件,但它们的功能相同。

您需要删除:Assets/Game/Plugins/Android/android-support-v4.jar