如何解决在64K方法问题的Dalvik编译器的限制吗? [英] How to solve the issue with Dalvik compiler limitation on 64K methods?

查看:135
本文介绍了如何解决在64K方法问题的Dalvik编译器的限制吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的团队和我继承了来自其他球队的大型Android项目。整个应用程序的所有库,包括据报有大约35000的方法。我们现在在应用程序,我们需要使用协议缓冲器,以实现新的服务任务。

My team and I have inherited a large Android project from another team. The whole application with all the included libraries is reported to have around 35000 methods. We now have the task to implement a new service in the app where we need to use Protocol Buffers.

的问题是,所生成的.jar文件与所有必要的.proto文件创建另一个几个35000方法,这是70000的方法。如果你不知道,Android的编译器有每个.dex文件65536方法的限制。我们显然超过了极限,我们得到以下错误试图编译应用程序:

The problem is that the generated .jar file with all the required .proto files creates another couple of 35000 methods, that's 70000 methods. And if you are not aware, the Android compiler has a limitation of 65536 methods per .dex file. We are clearly over that limit and we are getting the following error trying to compile the app:

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

是的,应用程序体系结构或许应该调整,但需要时间。而现在,我们正在试图找出一个解决方案,以解决此问题是暂时的。

Yes, the application architecture should probably be restructured but that will take time. And for now we are trying to figure out a solution to work around this problem temporarily.

有什么建议?

推荐答案

您可以使用另外一个DEX文件。这是你如何做到这一点:

You can use another DEX file. This is how you do it:

<一个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

这篇关于如何解决在64K方法问题的Dalvik编译器的限制吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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