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

Proguard issue after switching to 3.2.2 #1175

Closed
peterhav opened this issue Feb 28, 2018 · 13 comments
Closed

Proguard issue after switching to 3.2.2 #1175

peterhav opened this issue Feb 28, 2018 · 13 comments

Comments

@peterhav
Copy link
Contributor

  • Android device: N/A
  • Android OS version: minSDK 16
  • Google Play Services version: 11.8.0
  • Firebase/Play Services SDK version: 27
  • FirebaseUI version: 3.2.2

Step 3: Describe the problem:

Steps to reproduce:

  1. Switch from Firebase UI 3.2.1 to 3.2.2 in the build.gradle files
  2. Run Assemble task that includes minifyEnabled true

Observed Results:

 Build fails with this exception:

Initializing...

Warning: com.firebase.ui.auth.provider.TwitterProvider: can't find referenced class retrofit2.Call
Warning: com.firebase.ui.auth.provider.TwitterProvider: can't find referenced class retrofit2.Call

Note: io.grpc.internal.zzbq: can't find dynamically referenced class javax.naming.directory.InitialDirContext
Note: io.grpc.internal.zzbq: can't find dynamically referenced class com.sun.jndi.dns.DnsContextFactory
Note: there were 2 unresolved dynamic references to classes or interfaces.
      You should check if you need to specify additional program jars.
      (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass)

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)

Warning: Exception while processing task java.io.IOException: Please correct the above warnings first.
:app:transformClassesAndResourcesWithProguardForRelease FAILED

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


Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
See https://docs.gradle.org/4.6/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 2m 9s

52 actionable tasks: 40 executed, 12 up-to-date

Expected Results:

Build leading to production APK

@SUPERCILEX
Copy link
Collaborator

Oh shoot, so it was for us and not retrofit. @peterhav does adding -dontnote com.firebase.ui.auth.provider.** to your proguard rules work?

@peterhav
Copy link
Contributor Author

No, by adding -dontnote com.firebase.ui.auth.provider.**, I still get:

Warning: com.firebase.ui.auth.provider.TwitterProvider: can't find referenced class retrofit2.Call
Warning: com.firebase.ui.auth.provider.TwitterProvider: can't find referenced class retrofit2.Call

Note: io.grpc.internal.zzbq: can't find dynamically referenced class javax.naming.directory.InitialDirContext
Note: io.grpc.internal.zzbq: can't find dynamically referenced class com.sun.jndi.dns.DnsContextFactory
Note: there were 2 unresolved dynamic references to classes or interfaces.
      You should check if you need to specify additional program jars.
      (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass)

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)

Adding this makes the app build again, but I'm not sure this is correct and I have not been able to perform testing on the produced APK:

-dontwarn com.firebase.ui.**
-dontnote io.grpc.internal.**

@SUPERCILEX
Copy link
Collaborator

My B, I meant -dontwarn. Can you try that with my previous code?

@samtstern
Copy link
Contributor

Here are the recently removed rules (#1167):

-dontwarn okio.**	
-dontwarn retrofit2.Call	
-dontnote retrofit2.Platform$IOS$MainThreadExecutor

I think the one you want to add back is -dontwarn retrofit2.Call

@peterhav
Copy link
Contributor Author

@SUPERCILEX : With -dontwarn com.firebase.ui.auth.provider.** in my own proguard file the build is finishing successful.

@SUPERCILEX
Copy link
Collaborator

@samtstern I'd prefer to ignore our classes instead of third-party stuff that could change. Since @peterhav said -dontwarn com.firebase.ui.** works, I'm pretty sure -dontnote com.firebase.ui.auth.provider.** will work which will make far more sense to future devs. Do you agree?

@SUPERCILEX
Copy link
Collaborator

Oh hey, sweet! PR coming soon.

@samtstern samtstern added this to the 3.3.0 milestone Feb 28, 2018
@samtstern
Copy link
Contributor

Thanks @peterhav for the patience and @SUPERCILEX for the solutions!

I think we can leave this for 3.3.0 since it's such a simple workaround and it's not going to bite people at runtime (proguard fails, they find this issue, problem solved).

@SUPERCILEX we should find a way to make our CI fail for something like this. Maybe we need to be assembling the app module in release mode during builds?

@SUPERCILEX
Copy link
Collaborator

@samtstern agreed. 👍 As building app, we do. 😞 We'd have to build versions without the Twitter or Facebook dep. Not sure if we'd want to invest the time for something that hopefully won't have to change for a while.

@samtstern
Copy link
Contributor

That's fair, I didn't realize it only occurred in that situation.

@tayhengee
Copy link

I just downloaded the demo app, but it just couldn't even compile, it kept mentioning:
Error:FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring project ':auth'.

Failed to notify project evaluation listener.
SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
Could not get unknown property 'assembleRelease' for project ':auth' of type org.gradle.api.Project.

  • 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 0s

Any idea?

@samtstern
Copy link
Contributor

This issue has been fixed and released in 3.3.0.

@samtstern
Copy link
Contributor

Related issue:
#1227

Seems we're playing proguard whack-a-mole here 🤦‍♂️

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

4 participants