安卓:我的应用程序太大,并给出"无法执行DEX:方法ID不是在[0,0xFFFF的]:65536"? [英] Android: my application is too large and gives "Unable to execute dex: method ID not in [0, 0xffff]: 65536"?

查看:122
本文介绍了安卓:我的应用程序太大,并给出"无法执行DEX:方法ID不是在[0,0xFFFF的]:65536"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想结合我与盒,Dropbox的,和谷歌驱动器应用程序。所有3这些服务需要大量的第三方jar文件。此外,我的应用程序已经需要一些第三方罐。现在,当我尝试从Eclipse运行我的应用程序出现以下错误:

I am trying to integrate my application with Box, Dropbox, and Google Drive. All 3 of these services require a number of 3rd party jars. Additionally, my application already requires a few 3rd party jars. Now when I try to run my application from eclipse I get the following error:

无法执行DEX:方法ID不是在[0,0xFFFF的]:65536转换   到的Dalvik格式失败:无法执行DEX:方法ID不是在[0,   为0xFFFF]:65536

Unable to execute dex: method ID not in [0, 0xffff]: 65536 Conversion to Dalvik format failed: Unable to execute dex: method ID not in [0, 0xffff]: 65536

看来,出现这种错误,因为我的应用程序有太多的方法。我敢肯定大部分的这些方法都是从第三方jar文件,因此它是不现实的,试图通过简化我的code,以解决这个问题。我在网上找到这两个建议。

It seems that this error occurs because my application has too many methods. I'm fairly certain the bulk of these methods are from the 3rd party jars, so it is unrealistic to try to solve this by simplifying my code. I found these two suggestions online.

  1. 添加 dex.force.jumbo = TRUE 来project.properties(和使用ADT版本21)。我这样做,但仍然得到错误。

  1. add dex.force.jumbo=trueto project.properties (and use adt version 21). I did this but still get the error.

使用多个DEX文件如下解释:<一href="http://android-developers.blogspot.co.il/2011/07/custom-class-loading-in-dalvik.html">http://android-developers.blogspot.co.il/2011/07/custom-class-loading-in-dalvik.html.这似乎是唯一的选择,但我不明白它如何适用于我的情况。问题是服务,如驱动器有太多的依赖关系。这是不是解决方案,要求我修改驱动源使用拐点指的是其依赖的时候? (这显然不是一个选项)。

Use multiple dex files as explained here: http://android-developers.blogspot.co.il/2011/07/custom-class-loading-in-dalvik.html. This seems likely to be the only option, but I don't understand how it applies in my case. The issue is that services like Drive have too many dependencies. Wouldn't this solution require that I modify the Drive source to use inflection when referring to its dependencies? (this is clearly not an option).

使用ProGuard的萎缩删除未使用的code /方法。导出我的应用程序使用ProGuard不工作,和文档服务的整合工作按预期> 4.0的设备上。然而,ClassNotFound的2.3设备上进行测试时,错误抛出。

Use proguard to shrink remove unused code/methods. Exporting my application with proguard does work, and the document service integration works as expected on a >4.0 device. However, classnotfound errors are thrown when testing on a 2.3 device.

所以,我希望在这个问题上的一些建议。选项​​2我的情况的解决方案?有没有我应该考虑另一种解决办法?

So, I am hoping for some advice on this issue. Is option 2 a solution for my case? Is there another solution I should consider?

推荐答案

您也可以开发一个或一个以上的这些作为插件到你的主要的应用程序,在一个单独的APK可供下载的形式。这APK会暴露,主要的应用程序将使用一些组件 - 因为我不知道有这些服务的一体化的性质,我不能做出一个更具体的建议。你会用你自己的签名 -level定制&LT;许可&GT; ,以确保两个应用程序之间的通信。而且,作为奖励,如果使用第三方库增加了要求更多的权限,你只需要这些权限在插件APK,保持你的主要APK小。

You can also develop one or more of these as a plugin to your main app, in the form of a separate APK available for download. That APK would expose some component that the main app would use -- since I do not know the nature of your integration with these services, I cannot make a more specific recommendation about that. You would use your own signature-level custom <permission> to secure communications between the two apps. And, as a bonus, if using the third-party library adds requirements for additional permissions, you would only need those permissions in the plugin APK, keeping your main APK smaller.

这篇关于安卓:我的应用程序太大,并给出&QUOT;无法执行DEX:方法ID不是在[0,0xFFFF的]:65536&QUOT;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆