虽然dreared dex方法限制错误有问题,但我一直试图找到问题的快速解决方案。使用proguard后,我的apk被13k方法缩小,大部分来自我使用的库。这是构建过程的(稍微修改过的)相关输出。
-obfuscate:
[mkdir] Created dir: /bin/proguard
[jar] Building jar: /bin/proguard/original.jar
[proguard] ProGuard, version 5.0
[proguard] Reading input...
[proguard] Reading program jar [/libs/kryo-2.24.0.jar]
[proguard] Reading program jar [/libs/jackson-databind-2.1.1.jar]
[proguard] Reading program jar [libs/okhttp-1.1.0.jar]
[proguard] Reading program jar [/libs/realm-0.72.0.jar]
[proguard] Reading program jar [/libs/tape-1.1.0.jar]
[proguard] Reading program jar [/libs/google-play-services.jar]
[proguard] Reading program jar [/libs/AudienceNetwork.jar]
[proguard] Initializing...
[proguard] Ignoring unused library classes...
[proguard] Original number of library classes: 7170
[proguard] Final number of library classes: 1712
[proguard] Printing kept classes, fields, and methods...
[proguard] Shrinking...
有没有办法指导Proguard for Android保存中间罐,(这些库的缩小版本符合我的代码的需要,具有完全使用的功能集,仅此而已),只是在缩小后,但是在他们被aapt打包成一个巨大的blob之前?
答案 0 :(得分:2)
您可以创建自定义的缩小版Google Play服务,这可能足以避免65K方法ID限制。来自Droidcon London 2014的我presentation on creating smaller apps包含一些可能的ProGuard配置来创建这样一个缩小的库。