Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android App crashes on Release Build with the use of Proguard and Dagger

I'm new to the use of Proguard and Dagger for Android apps, so I would really appreciate if someone could give me a few pointers.

Proguard and Dagger have been implemented into the application. When the app is installed through debug mode (ie, pushed from Eclipse) there are no problems with running the app. However, when I run the release build of the app, it crashes with the following trace:

No injectable members on com.example.test.d. Do you want to add an injectable constructor? required by com.example.test.d com.example.test.SampleActivity.a
No injectable members on com.b.a.b. Do you want to add an injectable constructor? required by com.b.a.b com.example.test.SampleActivity.b
    at dagger.internal.h.a(ThrowingErrorHandler.java:34)
    at dagger.internal.Linker.a(Linker.java:136)
    at dagger.d.a(ObjectGraph.java:264)
    at dagger.d.a(ObjectGraph.java:238)
    at com.example.test.SampleApplication.a(SampleApplication.java:24)

I have followed the suggestions from: https://plus.google.com/108620120050432268974/posts/AAjvwg3Hmgg, by implementing the following into the proguard-project.txt:

-keep class * extends dagger.internal.Binding
-keep class * extends dagger.internal.ModuleAdapter
-keep class * extends dagger.internal.StaticInjection

but it doesn't seem to fix the issue. Suggestions? Thanks in advance.

like image 720
ShannonS Avatar asked Feb 28 '13 19:02

ShannonS


1 Answers

Proguard and dagger (pre)-compilation do not seem to work well together in release builds. See https://plus.google.com/117210567825404150882/posts/HGjnJJHbfMj

The "problem" is that the non-obfuscated package names will be compiled into the classes.

like image 88
Jörg Avatar answered Sep 29 '22 18:09

Jörg