Android 转换为 Dalvik 格式失败,错误 1 ​​- 导出 APK

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11883178/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 09:04:44  来源:igfitidea点击:

Conversion to Dalvik format failed with error 1 - Exporting APK

androidapk

提问by Mohamed Naguib

I want to export an apk for the project but each time i export i got an error saying Conversion to Dalvik format failed with error 1. I faced this error before while working on same project and when i get it I go to the project folder and delete jars from folder classes inside folder bin but in Exporting APK It doesn't work Can anyone help me ?

我想为项目导出一个 apk,但每次导出时我都会收到一个错误,说转换为 Dalvik 格式失败,错误 1。我之前在处理同一个项目时遇到过这个错误,当我得到它时,我转到项目文件夹和从文件夹 bin 内的文件夹类中删除 jars 但在导出 APK 中它不起作用任何人都可以帮助我吗?

回答by Lukap

Generally my experience with 'Conversion to Dalvik format failed with error 1' is that you need to do a project clean (if you use eclipse them from menu Project -> Clean ... ) this usually fixes the problem. Also right click on the project you want to export then Properties -> Android Tools -> Fix Project properties.

通常,我对“转换为 Dalvik 格式失败并出现错误 1”的经验是,您需要清理项目(如果您从菜单 Project -> Clean ... 使用 eclipse 它们),这通常可以解决问题。同样右键单击要导出的项目,然后单击 Properties -> Android Tools -> Fix Project properties。

If this doesn't help you then with terminal go to the project path

如果这对您没有帮助,则使用终端转到项目路径

cd /home/username/your_project_path

then

然后

rm -fr bin/*

Note: you may need to restart eclipse or at least select the project and refresh it (F5).

注意:您可能需要重新启动 eclipse 或至少选择项目并刷新它(F5)。

Hope this will help you, if still doesn't , please let me know

希望这对你有帮助,如果仍然没有,请告诉我

回答by Bhaskar

I solved this problem

我解决了这个问题

  1. Go to Project ? Properties ? Java Build Path ? Libraries and remove all except the "Android X.Y". click OK.
  2. Go to Project ? Clean ? Clean projects selected below ? select your project and click OK.
  1. 去项目?特性 ?Java构建路径?库并删除除“Android XY”之外的所有库。单击确定。
  2. 去项目?干净的 ?下面选择的清洁项目?选择您的项目,然后单击“确定”。

That should work.

那应该工作。

If you have a JAR file located somewhere in your project folders and THEN added it as a Java Path Library. It does not show up under the Package Explorer, so you don't notice it, but it does get counted twice, causing Dalvik error 1.

如果您的项目文件夹中有一个 JAR 文件,然后将其添加为 Java 路径库。它没有出现在 Package Explorer 下,所以你不会注意到它,但它确实被计算了两次,导致 Dalvik 错误 1。

回答by pretty angela

You guys don't have to remove libraries at all.

你们根本不必删除库。

Yes, the problem is caused by the libraries.

是的,问题是由库引起的。

BUT!!! What if you need the libraries to build? It doesn't make sense.

但!!!如果您需要构建库怎么办?这没有意义。

I had a same problem, and finally got the solution.

我遇到了同样的问题,终于得到了解决方案。

Add exceptions in the "proguard-project.txt" file having proguard config.

在具有 proguard 配置的“proguard-project.txt”文件中添加例外。

like this

像这样

-dontwarn android.support.**

That's it.

就是这样。

1) check what you have libraries on the project. check package name! not file name! see the list below "Android Dependencies". when you click "*.jar", you can see the package names in the jar file.

1)检查您在项目中拥有哪些库。检查包名!不是文件名!请参阅“Android 依赖项”下方的列表。当你点击“ *.jar”时,你可以在jar文件中看到包名。

Assuming that you have "aaa.jar". the jar have "org.jdesktop.application", "org.jdesktop.swingworker"

假设你有“aaa.jar”。罐子有“org.jdesktop.application”,“org.jdesktop.swingworker”

(Project) > Android Dependencies > aaa.jar > org.jdesktop.application
                                           > org.jdesktop.swingworker

2) just add like below

2)只需添加如下

-dontwarn org.jdesktop.**

into the (Project) > proguard-project.txt file.

进入(项目)> proguard-project.txt 文件。