简体   繁体   English

“转换为Dalvik格式失败,错误1” - 仅在导出时

[英]“Conversion to Dalvik format failed with error 1” — on export only

I know this is a repeat question but I've read and tried every solution on this site and I'm still getting the error; 我知道这是一个重复的问题,但我已经阅读并尝试了这个网站上的每个解决方案,我仍然得到错误; also, I'm getting it ONLY when I export my signed apk from Eclipse. 另外,我只是在从Eclipse导出我签名的apk时才得到它。 I'm able to build and run the unsigned apk. 我能够构建并运行unsigned apk。

I have: 我有:

  • Deleted (and later restored) all libraries from the build path 从构建路径中删除(并稍后还原)所有库
  • Cleaned and rebuilt all my projects 清理并重建了我的所有项目
  • Restarted Eclipse with -clean option 使用-clean选项重新启动Eclipse
  • Re-create the app project from scratch 从头开始重新创建应用程序项目

I know error 1 means I have duplicate symbols but I've checked, clean and rebuilt my build path a million times and I still get the error, only when I export . 我知道错误1意味着我有重复的符号,但我检查,清理和重建我的构建路径一百万次,我仍然得到错误, 只有当我导出

  • If I had duplicate symbols, wouldn't I get an error 1 for my unsigned apk too? 如果我有重复的符号,我也不会为我的未签名的apk收到错误1吗?
  • If I really do have duplicate symbols, how can I get Eclipse to tell me what they are? 如果我确实有重复的符号,我怎么能让Eclipse告诉我它们是什么? All I get from the export wizard is a one-line error dialog. 我从导出向导得到的只是一行错误对话框。 :( :(
  • I don't get any errors when I manually sign the apk, but when I install it on a phone I get a simple error: "Application not installed." 我手动签署apk时没有任何错误,但是当我在手机上安装它时,我得到一个简单的错误:“应用程序未安装”。 :(:( :( :(

My project structure is as follows: 我的项目结构如下:

  1. One Android library project with 99% of my code. 一个包含99%代码的Android库项目。 It has one copy of the required jar files in the build path. 它在构建路径中有一个所需的jar文件副本。
  2. One Android app project with two classes. 一个包含两个类的Android应用程序项目。 It references the library project via the Android tab, NOT the Java build path. 它通过Android选项卡引用库项目,而不是Java构建路径。 There are no additional sources, projects or libraries referenced in the build path except for Android 2.1. 除了Android 2.1之外,构建路径中没有引用其他源,项目或库。 I even re-created this project from scratch (I didn't re-created the library project because it's much bigger). 我甚至从头开始重新创建了这个项目(我没有重新创建库项目,因为它更大)。

Everything was working a few days ago! 几天前一切都在运作! Any suggestions are much appreciated! 任何建议都非常感谢!

Thanks in advance... 提前致谢...

EDIT-UPDATE: The error goes away when I disable Proguard. EDIT-UPDATE:当我禁用Proguard时,错误就消失了。 Very strange. 很奇怪。

This is an issue with Proguard in the Windows developer tools - edit Android SDK\\tools\\proguard\\bin\\Proguard.bat 这是Proguard在Windows开发人员工具中的一个问题 - 编辑Android SDK\\tools\\proguard\\bin\\Proguard.bat

Replace: 更换:

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

with: 有:

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

Keep a reference to this solution because next time you update the SDK tools it'll probably be reintroduced (has been present in last few releases). 保留对此解决方案的引用,因为下次更新SDK工具时,它可能会重新引入(已在最近几个版本中出现)。

将您的Proguard升级到最新版本,即4.7 ...从http://sourceforge.net/projects/proguard/files/latest/download?source=files ....下载压缩文件然后复制“lib”和“ bin“从zip到你的sdk / tools / proguard /的文件夹来替换默认的或者说旧的”bin“和”lib“....尝试再次导出你的项目...

Go to project and unselect Build Automatically. 转到项目并取消选择“自动构建”。 Then Clean the project and Build all. 然后清理项目并Build all。 Worked for me to export signed application package 为我工作导出已签名的应用程序包

This was driving me insane too. 这也让我疯了。 I tried everything, changed all my external libraries and so on but nothing worked. 我尝试了一切,改变了我所有的外部库等等,但没有任何效果。 I tried a newer version of proguard without success. 我尝试了更新版本的proguard但没有成功。

Turns out I was using a library called "GridLayout" to support older devices. 事实证明我正在使用名为“GridLayout”的库来支持旧设备。 After I renamed the class "GridLayout" to "CustomGridLayout" it worked fine. 在我将类“GridLayout”重命名为“CustomGridLayout”后,它工作正常。 Seems like you can't have duplicate class names. 好像你不能有重复的类名。

Here was the key that worked for me 这是对我有用的关键

http://android.foxykeep.com/dev/fix-the-conversion-to-dalvik-format-failed-with-error-1-with-adt-14 http://android.foxykeep.com/dev/fix-the-conversion-to-dalvik-format-failed-with-error-1-with-adt-14

Supposedly fixed in ADT-15, the workaround is 据推测固定在ADT-15中,解决方法是

1) For each X_src element,right click on it and then Build Path > Remove from build path. 1)对于每个X_src元素,右键单击它,然后单击Build Path>从构建路径中删除。

2) A popup will open. 2)弹出窗口将打开。 Make sure that “Also unlink the folder from the project” is checked and then accept it. 确保选中“同时取消链接文件夹与项目”,然后接受它。

You can still debug into library code but you need to manage your breakpoints in those projects and then step through the code in the class file tabs. 您仍然可以调试库代码,但是您需要在这些项目中管理断点,然后逐步执行类文件选项卡中的代码。

I tried a few of the above solutions, and had no luck. 我尝试了一些上述解决方案,但没有运气。 Then, I closed Eclipse, and re-opened it, and was able to export successfully. 然后,我关闭了Eclipse,并重新打开它,并且能够成功导出。 If I try again however, it wouldn't work. 如果我再试一次,那就不行了。

So, I think maybe I only get one successful export per "open" of Eclipse. 所以,我想也许每次“开放”Eclipse只能获得一次成功的导出。 Not an ideal solution by any means, but when all else fails give it a shot. 无论如何都不是理想的解决方案,但是当其他一切都失败时,请试一试。 It worked for me. 它对我有用。

The accepted answer to this question (from 2011) did not work for me. 这个问题(2011年起)的公认答案对我不起作用。 However, the correct answer to this question is posted here: 但是,这个问题的正确答案发布在这里:

Android export give a "Conversion to Dalvik format failed error1" Android导出给出“转换为Dalvik格式失败错误1”

Unselect Build Automatically works for me. 取消选择Build Automatically为我工作。 Tanks anjaneya; 坦克anjaneya;

0)Unselect Build Automatically 1) Clean the project 2) Build project. 0)自动取消选择构建1)清理项目2)构建项目。 3) Export Signed Application in Android Tools options. 3)在Android工具选项中导出签名的应用程序。

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

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