Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smoothie Proguard config breaks Firebase #330

Closed
ultimate-deej opened this issue Apr 30, 2019 · 8 comments
Closed

Smoothie Proguard config breaks Firebase #330

ultimate-deej opened this issue Apr 30, 2019 · 8 comments

Comments

@ultimate-deej
Copy link

I use Firebase Dynamic Links in my project. Turning ProGuard on caused FirebaseDynamicLinks.getInstance() to return null. After some digging it turned out that smoothie module was the cause.

At first removing this line seemed to help:
-adaptclassstrings
But I didn't want to remove smoothie from my project so I kept trying. After a while I came up with a rule that worked for me:
-keep class * { @javax.inject.Qualifier <init>(...); }

Btw, not being a ProGuard expert I would expect this to work instead:
-keep @javax.inject.Qualifier class *
But it doesn't 🤷‍♂️.

@stephanenicolas
Copy link
Owner

stephanenicolas commented Apr 30, 2019 via email

@ultimate-deej
Copy link
Author

It's not my code I want to preserve. Instead, I want FirebaseDynamicLinks.getInstance() to return a non-null value. As to why that rule works or how it affects Firebase, no clue. I discovered it accidentaly, basically. But it suddenly works so I'll just stick with it until a better solution is found.

@stephanenicolas
Copy link
Owner

stephanenicolas commented May 1, 2019 via email

@ultimate-deej
Copy link
Author

I couldn't find the Firebase Dynamic Links repo, this part of Firebase seems to be closed source. Anyway, I don't think it's a problem of Firebase. Because, isn't that rule too broad to be included in a library in the first place? And since it's not probably needed for TP2, could you consider removing it?

@ultimate-deej
Copy link
Author

ultimate-deej commented May 7, 2019

A clean project test has shown that -adaptclassstrings alone doesn't break Firebase. I'll investigate the issue further.

@zawadz88
Copy link
Contributor

I've encountered a similar issue when updating from TP 1.1.1 to 2.1.0.
The issue I'm having is with Firebase Performance though.

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.google.firebase.perf.a.b()' on a null object reference
        at com.google.android.gms.internal.firebase-perf.fd.b(Unknown Source:2)
        at com.google.android.gms.internal.firebase-perf.fd.a(Unknown Source:0)
        at com.google.android.gms.internal.firebase-perf.ff.run(Unknown Source:6)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at java.lang.Thread.run(Thread.java:764)

where com.google.firebase.perf.a is com.google.firebase.perf.FirebasePerformance
In my example, removing -adaptclassstrings did the trick.

@zawadz88
Copy link
Contributor

Also, I had to modify the ProGuard rules to have it working in my project with 2.x.

-dontwarn javax.inject.**
-dontwarn javax.annotation.**

had to be changed to

-keep class javax.inject.**
-keep class javax.annotation.**

and I had to add

-keepclassmembers class * {
	@javax.inject.Inject <init>(...);
	@javax.inject.Inject <init>();
	@javax.inject.Inject <fields>;
	public <init>(...);
}

@stephanenicolas
Copy link
Owner

The wiki has been updated. I close this oooolllddd ticket. Sorry about that @ultimate-deej

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants