Android的Roboguice不使用ProGuard工作 [英] Android Roboguice not working with Proguard

查看:152
本文介绍了Android的Roboguice不使用ProGuard工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的ProGuard-project.txt:

this is my proguard-project.txt:

-keep class com.google.inject.** { *; }
-keep class javax.inject.** { *; }
-keep class javax.annotation.** { *; }
-keep class roboguice.** { *; }

-keepattributes Signature
-keepattributes *Annotation*
-keep class roboguice.**

-keep class com.google.inject.** { *; }


-keepclassmembers class * {
    @com.google.inject.Inject <fields>;
    @com.google.inject.Inject <init>(...);
}
-keep class javax.inject.** { *; }
-keep class javax.annotation.** { *; }


-keep class com.appmanager.ui.activities.** { *; }
-keep class com.appmanager.ui.fragments.** { *; }

我收到500警告:
http://pastebin.com/HihG9c66

这怎么可能解决这一WARNNING并保持code崩溃?

How is it possible to resolve this warnning and keep the code from crashing?

推荐答案

目前(跟上最新)为RoboGuice ProGuard的设置正式名单可在的 https://github.com/roboguice/roboguice/wiki/ProGuard

The current (kept up-to-date) official list of ProGuard settings for RoboGuice is available at https://github.com/roboguice/roboguice/wiki/ProGuard

对于我来说,无论是部分未在该文件或不违约,我原本跳过,分别为:

For me, the parts either not in that file or weren't default and I skipped originally, were:

-keep class com.mynamespace.MyRoboGuiceModule { *; }
-keep class com.mynamespace.SomeObjectThatGetsInjected { *; }
-dontobfuscate

我真的不喜欢去除模糊处理。但它使人们更方便获得的ProGuard不通过每级一个接一个去工作。 (它是从公共崩溃报告映射堆栈跟踪少了一个步骤)。

I really didn't like removing obfuscation. But it makes it a lot easier to get ProGuard to work without going through every class one-by-one. (And it is one less step in mapping the stack traces from public crash reports.)

您还可以添加以下上面得到它来编译,但它仍然在运行时可能崩溃。所以总是测试所有codeS路径在编译发布版本!

You can also add the following to the above to get it to compile, but it may still crash at runtime. So always test all codes paths in the compiled release build!

-dontwarn roboguice.**
-dontwarn org.roboguice.**

这篇关于Android的Roboguice不使用ProGuard工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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