question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ProGuard configuration required for version 1.2.0

See original GitHub issue

Description

I have updated fresco library version from 1.1.0 to 1.2.0 and tried to build the project with ProGuard.

It seems like the build fails due to the obfuscation of two specific annotations that fresco depends on, starting from 1.2.0, which are

  • com.facebook.infer.annotation.ReturnsOwnership
  • com.facebook.infer.annotation.Functional

The error message is below:

Warning: com.facebook.common.util.TriState: can't find referenced class com.facebook.infer.annotation.Functional
Warning: com.facebook.common.util.TriState: can't find referenced class com.facebook.infer.annotation.Functional
Warning: com.facebook.common.util.TriState: can't find referenced class com.facebook.infer.annotation.Functional
Warning: com.facebook.common.util.TriState: can't find referenced class com.facebook.infer.annotation.Functional
Warning: com.facebook.common.util.TriState: can't find referenced class com.facebook.infer.annotation.Functional
Warning: com.facebook.common.util.TriState: can't find referenced class com.facebook.infer.annotation.Functional
Warning: com.facebook.common.util.TriState: can't find referenced class com.facebook.infer.annotation.Functional
Warning: com.facebook.common.util.TriState: can't find referenced class com.facebook.infer.annotation.Functional
Warning: com.facebook.drawee.controller.AbstractDraweeControllerBuilder: can't find referenced class com.facebook.infer.annotation.ReturnsOwnership
Warning: com.facebook.drawee.generic.GenericDraweeHierarchyInflater: can't find referenced class com.facebook.infer.annotation.ReturnsOwnership
....

FAILURE: Build failed with an exception.

Reproduction

The build fails for every attempt when updating fresco library version from 1.1.0 to 1.2.0. The build succeeds if the library version is specified to 1.1.0.

Additional Information

  • Fresco version: 1.2.0

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
shoheikawanocommented, Mar 29, 2017

Oops…my bad; I haven’t checked that documentation. Thanks for your info!

(By the way, in the future, possibly fresco could contain consumerProguardFiles configuration on its build.gradle file to include those ProGuard settings within the library itself so that users may no longer need to set up additional ProGuard setting on top of their own. 😃 (Glide seems to have done this already; I have pasted the code ref below as well).

Reference I have looked up:

Anyway, thanks for your quick response and help!

4reactions
shoheikawanocommented, Mar 29, 2017

@foghina Thank you for the quick response; adding these two dontwarn configuration fixes build failure and made the build to succeed for me.

-dontwarn com.facebook.infer.annotation.ReturnsOwnership
-dontwarn com.facebook.infer.annotation.Functional

Hopefully this is the minimum configuration required to make the build succeed, but still I am not 100% sure simply dontwarning them solves the entire issue here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ProGuard Manual: Version History - Guardsquare
Enabled as-needed execution in Gradle task. Using standard string interpolation for Gradle configuration. Reduced log levels for console output in Gradle task.
Read more >
Configuring ProGuard | CodePath Android Cliffnotes
ProGuard can be enabled by using the minifyEnabled option for any build type. If you intend to use it for production, it is...
Read more >
ProGuard Troubleshooting
Your configuration contains a -keep option to preserve the given method (or field), but no -keep option for the given class that is...
Read more >
Failed to instantiate AndroidPlatform class using ProGuard
It is expected for the release version of the Android app's build to run ... What ProGuard configuration do I need for Firebase...
Read more >
Introduce separate proguard configuration for androidTest ...
Essentially the gradle-based build will use the same proguard configuration also for the test app and in my case crashes the application very...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found