While running react native app I am getting following error:
`
Task :app:mergeDebugNativeLibs FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use ‘–warning-mode all’ to show the individual deprecation warnings.
See https://docs.gradle.org/6.9.2/userguide/command_line_interface.html#sec:command_line_warnings
574 actionable tasks: 2 executed, 572 up-to-date
FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ‘:app:mergeDebugNativeLibs’.
A failure occurred while executing com.android.build.gradle.internal.tasks.MergeJavaResWorkAction
2 files found with path ‘lib/armeabi-v7a/libfbjni.so’ from inputs:
– C:Usersnouman.gradlecachestransforms-36ef14503de3c85fa1ab2aba364d580cctransformedjetified-react-native-0.71.0-rc.0-debugjni
– C:Usersnouman.gradlecachestransforms-364faf76bb2f0142d731347d7bfff47d4transformedjetified-fbjni-0.3.0jni
If you are using jniLibs and CMake IMPORTED targets, see
https://developer.android.com/r/tools/jniLibs-vs-imported-targets
-
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 32s
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:
Execution failed for task ‘:app:mergeDebugNativeLibs’.
A failure occurred while executing com.android.build.gradle.internal.tasks.MergeJavaResWorkAction
2 files found with path ‘lib/armeabi-v7a/libfbjni.so’ from inputs:
– C:Usersnouman.gradlecachestransforms-36ef14503de3c85fa1ab2aba364d580cctransformedjetified-react-native-0.71.0-rc.0-debugjni
– C:Usersnouman.gradlecachestransforms-364faf76bb2f0142d731347d7bfff47d4transformedjetified-fbjni-0.3.0jni
If you are using jniLibs and CMake IMPORTED targets, see
https://developer.android.com/r/tools/jniLibs-vs-imported-targets
-
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 32s
at makeError (D:BayQi-Customer-Mobile-Appnode_modulesexecaindex.js:174:9)
at D:BayQi-Customer-Mobile-Appnode_modulesexecaindex.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (D:BayQi-Customer-Mobile-Appnode_modulesreact-nativenode_modules@react-native-communitycli-platform-androidbuildcommandsrunAndroidrunOnAllDevices.js:94:5)
at async Command.handleAction (D:BayQi-Customer-Mobile-Appnode_modules@react-native-communityclibuildindex.js:192:9)
info Run CLI with –verbose flag for more details.
`
I am trying to run my react native app in physical device but getting this error.
It was running okay but suddenly has stopped working
7
Answers
UPDATED ANSWER
📢 Patches for >= 0.63 We have prepared releases for all the main versions of react-native with an hotfix:
🛳 0.70.5: https://github.com/facebook/react-native/releases/tag/v0.70.5
🛳️ 0.69.7: https://github.com/facebook/react-native/releases/tag/v0.69.7
🛳 0.68.5: https://github.com/facebook/react-native/releases/tag/v0.68.5
🛳️ 0.67.5: https://github.com/facebook/react-native/releases/tag/v0.67.5
🛳️ 0.66.5: https://github.com/facebook/react-native/releases/tag/v0.66.5
🛳️ 0.65.3: https://github.com/facebook/react-native/releases/tag/v0.65.3
🛳️ 0.64.4: https://github.com/facebook/react-native/releases/tag/v0.64.4
🛳️ 0.63.5: https://github.com/facebook/react-native/releases/tag/v0.63.5
By updating to these patch versions, your Android build should start working again.
Source https://github.com/facebook/react-native/issues/35210
OLD ANSWER
Add this to your
android/build.gradle
,If that does not work for you (with the dynamic version), then hard code your version in:
PLEASE BE CAREFUL TO MOVE THIS VERSION WHEN YOU UPDATE REACT-NATIVE
Check this for more updates https://github.com/facebook/react-native/issues/35204
// Top-level build file where you can add configuration options common to all sub-projects/modules
This helped me to resolve the issue.
This is happening because all the templates reference the React Native dependency by range, like implementation
com.facebook.react:react-native:+
. Usually this dependency gets resolved from the local Maven repo in./node_modules/react-native/android
but, since it has been published to Maven Central, it’s now grabbing the very latest RC.You can resolve this problem by forcing the React Native dependency to the version you expect with something like this implementation
com.facebook.react:react-native:0.68.2!!
in your app’s Gradle file. The!!
is shorthand for restricting Gradle from upgrading if your project or its transitive dependencies depend on a newer version. AFAIK Maven Central is immutable and the published dependency can’t removed so this might be the only solution.Reference: https://github.com/facebook/react-native/issues/35204
Add following lines inside the android>build.gradle file –
This issue occurred from November 4th 2022. See the reference: https://github.com/facebook/react-native/issues/35210
Workaround: I have made the following changes & It is working:
New patch release for react-native
https://github.com/facebook/react-native/issues/35210#:%7E:text=We%20have%20prepared%20releases%20for%20all%20the%20main%20versions%20of%20react%2Dnative%20with%20an%20hotfix%3A
just update your package.json with latest react-native version
add this to your app/build.gradle