Skip to content

Version 3.3.0 breaks proguard again #1227

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

Closed
samtstern opened this issue Mar 29, 2018 · 16 comments
Closed

Version 3.3.0 breaks proguard again #1227

samtstern opened this issue Mar 29, 2018 · 16 comments

Comments

@samtstern
Copy link
Contributor

I am seeing this in one of my projects when upgrading from 3.2.2 to 3.3.0

Warning: com.firebase.ui.auth.data.remote.TwitterSignInHandler$TwitterSessionResult: can't find referenced class retrofit2.Call
Warning: com.firebase.ui.auth.data.remote.TwitterSignInHandler$TwitterSessionResult: can't find referenced class retrofit2.Call

We added this to our proguard config:

-dontwarn com.firebase.ui.auth.provider.**

But then we killed the provider classes.

I suspect the workaround is:

-dontwarn com.firebase.ui.data.remote.**
@samtstern samtstern added this to the 3.3.1 milestone Mar 29, 2018
@samtstern
Copy link
Contributor Author

Confirmed Workaround:

-dontwarn com.firebase.ui.auth.data.remote.**

@SUPERCILEX
Copy link
Collaborator

@samtstern 🤦‍♂️ Alright, that's it. I'm making a proguard test module. 👍

@bernaferrari
Copy link

bernaferrari commented Mar 30, 2018

At least you are not getting this:

Error in /Users/.../.gradle/caches/transforms-1/files-1.1/play-services-base-12.0.1.aar/d4cede01fde67af88a30dd3361237f85/proguard.txt:
  Expected field or method name at /Users/.../.gradle/caches/transforms-1/files-1.1/play-services-base-12.0.1.aar/d4cede01fde67af88a30dd3361237f85/proguard.txt:3:89
  com.google.android.gms.common.api.internal.BasePendingResult.ReleasableResultGuardian <fields>;

for a few weeks already. I submitted 74602137 on Issue Tracker, but someone at Google marked as private, I can't even see how my issue is going 😞. Has anyone here found any workaround for it?

@samtstern
Copy link
Contributor Author

samtstern commented Mar 30, 2018

@bernaferrari huh that issue actually came across my desk internally and I asked "Bernardo could you show all of your app's dependencies?" but I did not realize it was private so you were not getting the responses.

So, could you show your build.gradle file? Maybe app and project level.

Also I notice you're using Android Studio 3.2 Canary 6, could you try this with either 3.0 or 3.1 stable?

@bernaferrari
Copy link

bernaferrari commented Mar 30, 2018

@samtstern Sure. There was a project attached in that issue, I updated it here for 3.2 Canary 8.
fbui alpha08.zip
On 3.1 stable, I needed to put

compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }

and, for some reason, it was ignoring the ProGuard file, so I needed to put the twitter dependency, but everything worked fine after it. On 3.2 Canary 8, nothing solved.

@samtstern
Copy link
Contributor Author

Ok @bernaferrari if this is only an issue in 3.2 Canary 8 I think that's something we should just wait on, canary versions of Android Studio tend to break the build in amazing ways. I really can only justify investigating this as a FirebaseUI issue if it's present in a stable or beta version of Android Studio (which it seems like it is not?)

@bernaferrari
Copy link

Ok for now..

@SUPERCILEX
Copy link
Collaborator

I'm on canary 8 right now and it works fine. I've disabled R8 though... Have you tried that?

@bernaferrari
Copy link

@SUPERCILEX wow, worked, thanks.. 🤣 looks so simple now, r8 is the guilty.

@koolkvd
Copy link

koolkvd commented Apr 3, 2018

Android studio version 3.0.1 stable channel
Added a proguard rule : -dontwarn com.firebase.ui.auth.provider.**
does nothing and still causes this issue

Can someone tell me what to do? I am not even using retrofit2 or twitter apis anywhere

Error:Note: there were 11 duplicate class definitions.
(http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass)
Warning: com.firebase.ui.auth.data.remote.TwitterSignInHandler$TwitterSessionResult: can't find referenced class retrofit2.Call
Warning: com.firebase.ui.auth.data.remote.TwitterSignInHandler$TwitterSessionResult: can't find referenced class retrofit2.Call
Warning: there were 2 unresolved references to classes or interfaces.
You may need to add missing library jars or update their versions.
If your code works fine without the missing classes, you can suppress
the warnings with '-dontwarn' options.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.

Job failed, see logs for details

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 11s

@samtstern
Copy link
Contributor Author

@koolkvd see above
-dontwarn com.firebase.ui.auth.data.remote.**

@koolkvd
Copy link

koolkvd commented Apr 3, 2018

yea trying it now and seems like it's working. Why is this happening, i want to understand... I mean did i do something wrong?

@samtstern
Copy link
Contributor Author

@koolkvd no this is our fault. We moved some classes to the auth.data.remote package but didn't update our consumer proguard rules (the ones we export).

@btrautmann
Copy link
Contributor

btrautmann commented Apr 12, 2018

We moved some classes to the auth.data.remote package but didn't update our consumer proguard rules (the ones we export).

@samtstern More for my curiosity than anything, but I've had this issue in my own app (where I move classes but forget to update proguard rules)... Are @Keep annotations not a way to solve this (i.e. keep the -keep statements out of rules and use annotations only)? Would this work in a library fashion as well, or no?

@SUPERCILEX
Copy link
Collaborator

SUPERCILEX commented Apr 12, 2018

@btrautmann I guess we could write a custom annotation and add a proguard rule for it, but we aren't planning on touching those classes for months... Great idea to keep in mind if we mess up again! 😊 (Or if you want to make a PR, I don't think anyone would object. 😉)

PS: what we're doing is different than the keep rule, we're just trying to tell proguard that it should ignore class not found warnings.

@samtstern
Copy link
Contributor Author

This has been fixed and released in 3.3.1

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

No branches or pull requests

5 participants