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.

Error when assembling Android release with proguard

See original GitHub issue

Description

After creating a new React Native project, enabling proguard per these instructions, and building a release Android build I get the following error:

Note: there were 2 references to unknown classes.
      You should check your configuration for typos.
      (http://proguard.sourceforge.net/manual/troubleshooting.html#unknownclass)
Note: there were 654 unkept descriptor classes in kept class members.
      You should consider explicitly keeping the mentioned classes
      (using '-keep').
      (http://proguard.sourceforge.net/manual/troubleshooting.html#descriptorclass)
Note: there were 7 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 1 unresolved references to library class members.
         You probably need to update the library versions.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibraryclassmember)
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.

BUILD FAILED

The specific warning in the output is:

Warning: com.facebook.fbui.textlayoutbuilder.proxy.StaticLayoutProxy: can't find referenced method 'StaticLayout(java.lang.CharSequence,int,int,android.text.TextPaint,int,android.text.Layout$Alignment,android.text.TextDirectionHeuristic,float,float,boolean,android.text.TextUtils$TruncateAt,int,int)' in library class android.text.StaticLayout

Reproduction

  1. react-native init --version="0.42.0" myapp
  2. cd myapp/android
  3. sed -i -e 's/enableProguardInReleaseBuilds = false/enableProguardInReleaseBuilds = true/g' app/build.gradle
  4. ./gradlew --offline assembleRelease
  5. Notice the error above

Solution

Don’t know

Additional Information

  • React Native version: 0.42.0
  • Platform: Android
  • Development Operating System: Mac OS X 10.11.6
  • Dev tools: I have Android API levels 23-25 installed

Issue Analytics

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

github_iconTop GitHub Comments

9reactions
jxr202commented, Jan 12, 2018

我有一个一样的问题,按 #11891的方法还是没解决,你的解决了么?

2reactions
d-rahulcommented, May 2, 2018

This issue is coming due to pro-guard enable in the release config of the app. So the solution is either remove pro-guard or put the indicated code snippet as in the link https://readyandroid.wordpress.com/errorexecution-failed-for-task-apptransformclassesandresourceswithproguardforrelease/

Read more comments on GitHub >

github_iconTop Results From Across the Web

Proguard error while building apk release for android [duplicate]
Turning off Minification worked for me when faced with this issue: In your build.gradle file: buildTypes { release { minifyEnabled false.
Read more >
Troubleshooting ProGuard issues on Android - Medium
It is very important to test the release build (with ProGuard enabled) of your app thoroughly and deal with these errors. There are...
Read more >
ProGuard Manual: Troubleshooting - Guardsquare
If the missing class is an Android run-time class, you should make sure that you are building against an Android run-time that is...
Read more >
Proguard in Release mode error - Visual Studio Feedback
We have a Xamarin Forms project in VSTS, and we have a build that was working fine when Building the Xamarin.Droid project with...
Read more >
Configure build variants | Android Developers
Error: All flavors must now belong to a named flavor dimension. ... product flavors, and kept the default "debug" and "release" build types, ......
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