Proguard 和 Dalvik 错误代码 1

发布于 2024-12-25 11:07:19 字数 1223 浏览 0 评论 0原文

我在使用 ProGuard 混淆代码时遇到了问题。我已经尝试了其他类似问题的所有建议,但仍然不起作用。

本质上,以下是我可以从这种情况中收集到的所有事实:

  • 我的库已设置为 ViewPagerIndicator 被 ActionBarSherlock 引用,而 ActionBarSherlock 又被 FormulaeLib 引用,而 FormulaeLib 又被应用程序 FormulaePro 引用。
  • 尝试使用 ant 也会失败,在 /tools/ant/build.xml 第 485、602 和 622 行中出现错误,
  • 注释掉 project.properties 中的 proguard 配置将会成功构建。
  • 我正在使用 ProGuard 4.7

更新:

  • 我现在已经将此问题追溯到我的 CursorLoader 实现。我遇到了很多问题,现在我又回到使用(已弃用的)管理查询(..)加载游标的方法。

控制台输出的结尾:

[2012-01-06 17:45:07 - FormulaePro] applyFileOverlay for mipmap
<lots of "new resource id" things>
[2012-01-06 17:45:43 - FormulaePro]     (new resource id view from D:\Dropbox\Android\FormulaeLib\res\menu\view.xml)
[2012-01-06 17:45:43 - FormulaePro]   Writing symbols for class R.
[2012-01-06 17:45:43 - FormulaePro]   Writing symbols for class R.
[2012-01-06 17:45:43 - FormulaePro]   Writing symbols for class R.
[2012-01-06 17:45:43 - FormulaePro]   Writing symbols for class R.
[2012-01-06 17:45:45 - FormulaePro] Starting full Package build.
[2012-01-06 17:45:45 - FormulaePro] Skipping over Post Compiler.

那么,比我聪明得多的人能弄清楚到底发生了什么吗?

I've been having a problem with obfuscating my code using ProGuard. I've tried all the suggestions on the other, similar questions on here and still it doesn't work.

Essentially, here are all the facts I can glean from the situation:

  • My libraries are set up so that ViewPagerIndicator is referenced by ActionBarSherlock, which in turn is referenced by FormulaeLib which is referenced by the app, FormulaePro.
  • trying to use ant also fails, with errors at <sdk_dir>/tools/ant/build.xml lines 485, 602 and 622
  • commenting out the proguard configuration in project.properties will give a successful build.
  • I'm using ProGuard 4.7

UPDATES:

  • I've now traced this problem back to my CursorLoader implementation. I've had so many problems with this, I have now just gone back to using the (deprecated) managedQuery(..) method of loading cursors.

The end of the console output:

[2012-01-06 17:45:07 - FormulaePro] applyFileOverlay for mipmap
<lots of "new resource id" things>
[2012-01-06 17:45:43 - FormulaePro]     (new resource id view from D:\Dropbox\Android\FormulaeLib\res\menu\view.xml)
[2012-01-06 17:45:43 - FormulaePro]   Writing symbols for class R.
[2012-01-06 17:45:43 - FormulaePro]   Writing symbols for class R.
[2012-01-06 17:45:43 - FormulaePro]   Writing symbols for class R.
[2012-01-06 17:45:43 - FormulaePro]   Writing symbols for class R.
[2012-01-06 17:45:45 - FormulaePro] Starting full Package build.
[2012-01-06 17:45:45 - FormulaePro] Skipping over Post Compiler.

So, can someone much cleverer than me figure out what the heck is going on?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

溺孤伤于心 2025-01-01 11:07:19

您最近是否升级到 SDK Tools rev 14 或更高版本?

我并不比你聪明,但你描述的问题让我想起

如果是这种情况,请尝试来自令人惊叹的@TheTerribleSwiftTomato的此解决方案

  1. 在您的应用项目中,检查是否有任何链接的源文件夹指向您的库项目(它们的名称格式为“LibraryName_src”)。
  2. 选择所有这些项目,右键单击,选择“构建路径”->“从构建路径中删除”。
  3. 选择“同时取消文件夹与项目的链接”,然后单击“是”。
  4. 清理、重建和重新部署项目。

更新:我最近遇到的另一种情况:您重命名了其中一个类。在这种情况下,proguard 文件夹中生成的文件(dump.txt、mapping.txt、seeds.txt、usage.ext)可能不会反映该更改。在这种情况下,删除全部 4 个。它们将在您下次使用 File > 时自动生成。导出 - 这次不会生成可怕的“Dalvik 错误 1”。

祝你好运!

Have you recently upgraded to SDK Tools rev 14 or higher?

I am not cleverer than you are, but the problem you are describing reminds me of my recent awful experience with Dalvik error 1.

If this is the case, try this solution from the amazing @TheTerribleSwiftTomato:

  1. In your app project, check for any linked source folders pointing to your library projects (they have names in the form "LibraryName_src").
  2. Select all those projects, right-click, choose "Build Path"->"Remove from Build Path".
  3. Choose "Also unlink the folder from the project", and click "Yes".
  4. Clean, rebuild and redeploy the project.

Update: Another scenario I recently encountered: You renamed one of the classes. In that case, the files generated in the proguard folder (dump.txt, mapping.txt, seeds.txt, usage.ext) may not reflect that change. In that case, delete all 4 of them. They will automatically generated next time you use the File > Export - this time not generating the dreaded "Dalvik error 1".

Good luck!

被翻牌 2025-01-01 11:07:19

除了@Bill The Ape提到的几点之外,您在更新SDK后是否升级了您的proguard文件?

这可能是问题所在,请查看此处:https://stackoverflow.com/a/7386541/327011

Besides the points refered by @Bill The Ape, have you upgraded your proguard files after updating the SDK?

That can be the problem, check out here: https://stackoverflow.com/a/7386541/327011

┊风居住的梦幻卍 2025-01-01 11:07:19

我最近在更新 Android SDK 后遇到了 proguard 错误...我也不断收到“错误 1”问题。对我来说解决这个问题的方法是下载最新的 proguard 二进制文件并替换 Android SDK 附带的二进制文件。

希望这对大家也有帮助...

http://sourceforge.net/projects/proguard/文件/

I recently had an error with proguard after updating the Android SDK... I kept getting an "Error 1" issue as well. What fixed it for me was downloading the latest proguard binaries and replacing the ones that came with the Android SDK.

Hopefully this helps for all of you as well...

http://sourceforge.net/projects/proguard/files/

拥抱没勇气 2025-01-01 11:07:19

请删除库和再次配置构建路径,然后 Dalvik 虚拟机错误将被删除。

尝试再次修复 1.6 编译器的属性。

尝试一下就能解决你的问题!!!

Please Remove library & Once again Configure build path then the Dalvik Virtual Machine Error will be removed.

Try to Fix properties to 1.6 Compiler Once again.

Try it will resolve your issue!!!

无悔心 2025-01-01 11:07:19

我昨天升级到 ADT 16 时也遇到了同样的问题。为了解决问题,我删除了 ADT 16 并安装了 ADT 15。

试试这个。这可能会解决你的问题

i also got same problem when i upgraded to ADT 16 yesterday. To solve problem I removed ADT 16 and installed ADT 15.

Try this. This might solve your problem

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文