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

Task :app:minifyReleaseWithR8 FAILED #36505

Closed
BillDelvin opened this issue Mar 16, 2023 · 4 comments
Closed

Task :app:minifyReleaseWithR8 FAILED #36505

BillDelvin opened this issue Mar 16, 2023 · 4 comments

Comments

@BillDelvin
Copy link

BillDelvin commented Mar 16, 2023

Description

Hi, I wondering if there is way to solve this problem, I got this problem when I want to build my apps using command ./gradlew assembleRelease and after waiting 89% process for build, then this error showup. I already following few option and clue but the problem stil showup

Task :app:minifyReleaseWithR8 FAILED
ERROR:/Users/billdelvin/.gradle/caches/transforms-3/265611c8801979aeb3f4ce2fa85c66b8/transformed/jetified-react-native-0.69.8-release-runtime.jar: R8: Type com.facebook.fbreact.specs.NativeDevLoadingViewSpec is defined multiple times: /Users/billdelvin/.gradle/caches/transforms-3/265611c8801979aeb3f4ce2fa85c66b8/transformed/jetified-react-native-0.69.8-release-runtime.jar:com/facebook/fbreact/specs/NativeDevLoadingViewSpec.class, /Users/billdelvin/Documents/project/sentris-resident/front-end/sentris_mobile_security/android/app/build/intermediates/javac/release/classes/com/facebook/fbreact/specs/NativeDevLoadingViewSpec.class

FAILURE: Build failed with an exception.

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

com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: /Users/billdelvin/.gradle/caches/transforms-3/265611c8801979aeb3f4ce2fa85c66b8/transformed/jetified-react-native-0.69.8-release-runtime.jar:com/facebook/fbreact/specs/NativeDevLoadingViewSpec.class

React Native Version

0.69.8

Output of npx react-native info

System:
OS: macOS 13.2.1
CPU: (8) arm64 Apple M1 Pro
Memory: 140.89 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 18.12.1 - ~/.nvm/versions/node/v18.12.1/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 8.19.2 - ~/.nvm/versions/node/v18.12.1/bin/npm
Watchman: 2023.03.06.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK:
API Levels: 21, 23, 28, 29, 30, 31, 32, 33
Build Tools: 29.0.2, 30.0.2, 30.0.3, 31.0.0, 32.0.0, 33.0.0, 33.0.0, 33.0.0, 34.0.0
System Images: android-31 | Google Play ARM 64 v8a, android-32 | Google APIs ARM 64 v8a
Android NDK: 22.1.7171670
IDEs:
Android Studio: 2022.1 AI-221.6008.13.2211.9514443
Xcode: 13.3.1/13E500a - /usr/bin/xcodebuild
Languages:
Java: 11.0.16.1 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.0.0 => 18.0.0
react-native: 0.69.8 => 0.69.8
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps to reproduce

wix/Detox#2452

https://stackoverflow.com/questions/60896733/execution-failed-for-task-appminifyreleasewithr8-java-lang-nullpointerexcept

https://stackoverflow.com/questions/64459937/could-not-create-task-appminifyreleasewithr8-cannot-query-the-value-of-this

Snack, code example, screenshot, or link to a repository

Unfortunately, I can't choose the option yet.

@BillDelvin
Copy link
Author

Found solution for this problem, there is a package called apply plugin: "com.facebook.react" in app/build.gradel
so I remove it and it working again

@gabriel-logan
Copy link

Well, I see that you apparently solved it your way.

But I'll leave some help here for possible similar problems.

ERROR: Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in /home/user/Desktop/Apps/Project/my-app/android/app/build/outputs/mapping/release/missing_rules.txt.

If you see this error in your error logs, just go to the folder where it says in the log, copy the codes that are in the missing_rules.txt file

And paste it into your proguard-rules.pro file

@talhatsk
Copy link

Well, I see that you apparently solved it your way.

But I'll leave some help here for possible similar problems.

ERROR: Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in /home/user/Desktop/Apps/Project/my-app/android/app/build/outputs/mapping/release/missing_rules.txt.

If you see this error in your error logs, just go to the folder where it says in the log, copy the codes that are in the missing_rules.txt file

And paste it into your proguard-rules.pro file

this worked, Thanks 🙏

@GSFZamai
Copy link

GSFZamai commented Oct 11, 2024

Well, I see that you apparently solved it your way.

But I'll leave some help here for possible similar problems.

ERROR: Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in /home/user/Desktop/Apps/Project/my-app/android/app/build/outputs/mapping/release/missing_rules.txt.

If you see this error in your error logs, just go to the folder where it says in the log, copy the codes that are in the missing_rules.txt file

And paste it into your proguard-rules.pro file

This worked for me, but only to build my release version.

But the builded application crashes on initialization...

The other part for my solution was to add the following line to my gradle.propeties as suggested in the R8's documentation:

android.enableR8.fullMode=false

this remove the R8's additional optimizations.

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

5 participants