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

Build Error with Android | React-native-gradle-plugin broken | Crypto tink library issue #34295

Closed
agrittiwari opened this issue Jul 28, 2022 · 8 comments
Labels
Platform: Android Android applications. Resolution: Answered When the issue is resolved with a simple answer

Comments

@agrittiwari
Copy link

Description

BUILD FAILED in 10s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

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

java.util.concurrent.ExecutionException: org.gradle.api.GradleException: Failed to create Jar file C:\Users\AGRIT.gradle\caches\jars-9\2f0317f12d54d6c10096ba1dbae69156\tink-1.3.0-rc2.jar.

  • 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.

BUILD FAILED in 10s

at makeError (E:\reactnative\bookNorder_wo_expo\node_modules\execa\index.js:174:9)
at E:\reactnative\bookNorder_wo_expo\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (E:\reactnative\bookNorder_wo_expo\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (E:\reactnative\bookNorder_wo_expo\node_modules\@react-native-community\cli\build\index.js:192:9)

info Run CLI with --verbose flag for more details.

Version

0.69.3

Output of npx react-native info

ystem:
OS: Windows 10 10.0.19044
CPU: (8) x64 Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
Memory: 1.17 GB / 7.91 GB
Binaries:
Node: 16.14.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.17 - ~\AppData\Roaming\npm\yarn.CMD
npm: 8.5.4 - C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK: Not Found
IDEs:
Android Studio: Version 2021.1.0.0 AI-211.7628.21.2111.8193401
Visual Studio: Not Found
Languages:
Java: 11.0.13
npmPackages:
@react-native-community/cli: Not Found
react: 18.0.0 => 18.0.0
react-native: 0.69.3 => 0.69.3
react-native-windows: Not Found
npmGlobalPackages:
react-native: Not Found

Steps to reproduce

npx react-native init AwesomeProject

npm run android

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

[{
"resource": "/E:/reactnative/bookNorder_wo_expo/android/",
"owner": "generated_diagnostic_collection_name#1",
"code": "0",
"severity": 8,
"message": "The supplied phased action failed with an exception.\r\nA problem occurred configuring root project 'bookNorder_wo_expo'.\r\njava.util.concurrent.ExecutionException: org.gradle.api.GradleException: Failed to create Jar file C:\Users\AGRIT\.gradle\caches\jars-9\2f0317f12d54d6c10096ba1dbae69156\tink-1.3.0-rc2.jar.\r\norg.gradle.api.GradleException: Failed to create Jar file C:\Users\AGRIT\.gradle\caches\jars-9\2f0317f12d54d6c10096ba1dbae69156\tink-1.3.0-rc2.jar.\r\nFailed to create Jar file C:\Users\AGRIT\.gradle\caches\jars-9\2f0317f12d54d6c10096ba1dbae69156\tink-1.3.0-rc2.jar.\r\nFailed to process the entry 'com/google/crypto/tink/proto/HmacParams$Builder.class' from 'C:\Users\AGRIT\.gradle\caches\modules-2\files-2.1\com.google.crypto.tink\tink\1.3.0-rc2\c7efb1ecc3b667b8a0789a1b019b06269037e19b\tink-1.3.0-rc2.jar'\r\nData error (cyclic redundancy check)",
"source": "Java",
"startLineNumber": 1,
"startColumn": 1,
"endLineNumber": 1,
"endColumn": 1
}]

@agrittiwari agrittiwari added Needs: Triage 🔍 Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules) labels Jul 28, 2022
@agrittiwari agrittiwari changed the title Build Error with Build Error with Android | React-native-gradle-plugin broken | Crypto tink library issue Jul 28, 2022
@react-native-bot react-native-bot added the Platform: Android Android applications. label Jul 28, 2022
@agrittiwari
Copy link
Author

The error logs leads to the following repository/library, https://mvnrepository.com/artifact/com.google.crypto.tink/tink-android which is the same error I found while upgrading to new architecture.

And hence these are managed by this new react-native-gradle-plugin, it has some bugs into it or maybe some other reason

@cortinico
Copy link
Contributor

This is most likely related to a faulty setup. I suggest you clean up some of your caches as Gradle is failing to store locally some of the dependency. I would try to remove the C:\Users\AGRIT\.gradle\ folder and rebuild.

@agrittiwari
Copy link
Author

That folder is around 5GB in size. I don't want to disturb my other work environment and projects which are working fine.

@cortinico Will that action be fine?

@github-actions github-actions bot added Needs: Attention Issues where the author has responded to feedback. and removed Needs: Author Feedback labels Jul 31, 2022
@agrittiwari
Copy link
Author

agrittiwari commented Aug 1, 2022

@cortinico I did delete that folder but it lead me to new error in this new project


Starting a Gradle Daemon, 2 incompatible and 1 stopped Daemons could not be reused, use --status for details
6 actionable tasks: 2 executed, 4 up-to-date

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'bookNorder_wo_expo'.
> java.util.concurrent.ExecutionException: org.gradle.api.GradleException: Failed to create Jar file C:\Users\AGRIT\.gradle\caches\jars-9\2f0317f12d54d6c10096ba1dbae69156\tink-1.3.0-rc2.jar.

* 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 4m 2s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'bookNorder_wo_expo'.
> java.util.concurrent.ExecutionException: org.gradle.api.GradleException: Failed to create Jar file C:\Users\AGRIT\.gradle\caches\jars-9\2f0317f12d54d6c10096ba1dbae69156\tink-1.3.0-rc2.jar.

* 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 4m 2s

    at makeError (E:\reactnative\bookNorder_wo_expo\node_modules\@react-native-community\cli-platform-android\node_modules\execa\index.js:174:9)
    at E:\reactnative\bookNorder_wo_expo\node_modules\@react-native-community\cli-platform-android\node_modules\execa\index.js:278:16
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async runOnAllDevices (E:\reactnative\bookNorder_wo_expo\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
    at async Command.handleAction (E:\reactnative\bookNorder_wo_expo\node_modules\@react-native-community\cli\build\index.js:192:9)
info Run CLI with --verbose flag for more details.

and my other project is also having an error now

Starting a Gradle Daemon (subsequent builds will be faster)

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'planbttr'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not download tink-1.3.0-rc2.jar (com.google.crypto.tink:tink:1.3.0-rc2)
      > Could not get resource 'https://jcenter.bintray.com/com/google/crypto/tink/tink/1.3.0-rc2/tink-1.3.0-rc2.jar'.
         > java.io.IOException: Data error (cyclic redundancy check)

* 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 4m 27s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'planbttr'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not download tink-1.3.0-rc2.jar (com.google.crypto.tink:tink:1.3.0-rc2)
      > Could not get resource 'https://jcenter.bintray.com/com/google/crypto/tink/tink/1.3.0-rc2/tink-1.3.0-rc2.jar'.
         > java.io.IOException: Data error (cyclic redundancy check)

* 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 4m 27s

    at makeError (E:\Work\april 10\pb_userModule\reactnative_ui\node_modules\execa\index.js:174:9)
    at E:\Work\april 10\pb_userModule\reactnative_ui\node_modules\execa\index.js:278:16
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async runOnAllDevices (E:\Work\april 10\pb_userModule\reactnative_ui\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
    at async Command.handleAction (E:\Work\april 10\pb_userModule\reactnative_ui\node_modules\@react-native-community\cli\build\index.js:186:9)  
info Run CLI with --verbose flag for more details.

Would need some direction to solve this, please!
@leotm As I refer to this issue from your P.R. React native is not compatible with openJDK 18 and mine is

openjdk version "11.0.13" 2021-10-19
OpenJDK Runtime Environment 18.9 (build 11.0.13+8)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.13+8, mixed mode)

This issue clears doubt against my jdk version.

Needhelp1

@leotm
Copy link
Contributor

leotm commented Aug 1, 2022

have you checked your npx react-native info and java --version matches our 0.69 docs?
https://reactnative.dev/docs/environment-setup mentioned and linked in the error msg

if all setup correct, have you tried to repro after a fresh git clean -fdx in your project?

if still happening, i agree with @cortinico and would clean your Windows Gradle cache as he suggested
rm -rf ~/.gradle has fixed Gradle caching issues for me in the past on macOS
(i'm don't do React Native work on Windows, macOS and Linux are enough 😆)

if still happening after that, could you link us to a minimal repro starting from npx react-native init AwesomeProject?

@agrittiwari
Copy link
Author

Thanks @leotm and @cortinico , I rebooted my system to delete the residual and temp files and now everything works.

@cortinico cortinico added Resolution: Answered When the issue is resolved with a simple answer and removed Needs: Attention Issues where the author has responded to feedback. labels Aug 5, 2022
@Peter-Dumbari
Copy link

My question have not being answered

@cortinico cortinico removed the Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules) label Feb 7, 2023
@OmranElmasry
Copy link

run npm run instrumentDynatrace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: Android Android applications. Resolution: Answered When the issue is resolved with a simple answer
Projects
None yet
Development

No branches or pull requests

7 participants
@leotm @cortinico @OmranElmasry @react-native-bot @agrittiwari @Peter-Dumbari and others