Task :app:transformNativeLibsWithMergeJniLibsForDebug FAILED

Kau*_*Jha 5 reactjs react-native

I am working with react native and every time I build a new project it seems to work on my device , but whenever I try to restart it It is giving me 1 or more errors

I have tried looking for solutions on github but none of them are clear I will post the entire error message here.

react-native run-android info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag. Jetifier found 855 file(s) to forward-jetify. Using 4 workers... info Starting JS server... info Installing the app... Starting a Gradle Daemon (subsequent builds will be faster)

Task :app:transformNativeLibsWithMergeJniLibsForDebug FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings 24 actionable tasks: 2 executed, 22 up-to-date

FAILURE: Build failed with an exception.

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

    Could not read path 'C:\REACT_NATIVE\AwesomeProject2\android\app\build\intermediates\transforms\mergeJniLibs\debug\0\lib\arm64-v8a'.

  • 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 57s

error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

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

    Could not read path 'C:\REACT_NATIVE\AwesomeProject2\android\app\build\intermediates\transforms\mergeJniLibs\debug\0\lib\arm64-v8a'.

  • 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 57s

at checkExecSyncError (child_process.js:623:11)
at execFileSync (child_process.js:641:15)
at runOnAllDevices (C:\REACT_NATIVE\AwesomeProject2\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:75:39)
at buildAndRun (C:\REACT_NATIVE\AwesomeProject2\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:169:41)
at C:\REACT_NATIVE\AwesomeProject2\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:135:12
at processTicksAndRejections (internal/process/task_queues.js:85:5)
at async Command.handleAction (C:\REACT_NATIVE\AwesomeProject2\node_modules\react-native\node_modules\@react-native-community\cli\build\cliEntry.js:160:7)
Run Code Online (Sandbox Code Playgroud)

小智 13

转到 android/app/build.gradle 在 android 下添加以下内容

android {
    ...
+   packagingOptions {
+       pickFirst '**/libjsc.so'
+       pickFirst 'lib/x86/libc++_shared.so'
+       pickFirst 'lib/x86_64/libjsc.so'
+       pickFirst 'lib/arm64-v8a/libjsc.so'
+       pickFirst 'lib/arm64-v8a/libc++_shared.so'
+       pickFirst 'lib/x86_64/libc++_shared.so'
+       pickFirst 'lib/armeabi-v7a/libc++_shared.so'  
+   }
}
Run Code Online (Sandbox Code Playgroud)

运行清洁任务为我解决了问题。在您项目的 android 目录中,使用“clean”运行 gradle 包装器

cd android && ./gradlew clean

然后您可以返回项目目录并再次尝试运行。

cd .. && react-native run-android


Kau*_*Jha 12

运行清洁任务可以为我解决问题。在项目的android目录中,使用“ clean”运行gradle wrapper

cd android && ./gradlew clean 
Run Code Online (Sandbox Code Playgroud)

Then you can go back to project dir and try running again.

cd .. && react-native run-android
Run Code Online (Sandbox Code Playgroud)

  • 谢谢,为我工作。但我必须在没有点斜杠的情况下运行“gradlew clean”。 (2认同)