任务 :app:transformNativeLibsWithMergeJniLibsForDebug 失败 [英] Task :app:transformNativeLibsWithMergeJniLibsForDebug FAILED
问题描述
我正在使用 react native,每次我构建一个新项目时,它似乎都可以在我的设备上运行,但是每当我尝试重新启动它时,它都会给我 1 个或多个错误
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
我曾尝试在 github 上寻找解决方案,但没有一个是明确的,我将在此处发布整个错误消息.
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-androidinfo 运行 jetifier 将库迁移到 AndroidX.您可以使用--no-jetifier"标志禁用它.Jetifier 找到了 855 个要转发 Jetify 的文件.使用 4 个工人...info 正在启动 JS 服务器...信息 安装应用程序...启动 Gradle 守护进程(后续构建会更快)
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)
任务:app:transformNativeLibsWithMergeJniLibsForDebug FAILED
Task :app:transformNativeLibsWithMergeJniLibsForDebug FAILED
此版本中使用了弃用的 Gradle 功能,使其与 Gradle 6.0 不兼容.使用--warning-mode all"来显示单个弃用警告.请参阅 https://docs.gradle.org/5.4.1/用户指南/command_line_interface.html#sec:command_line_warnings24 个可操作的任务:2 个已执行,22 个最新
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:构建失败,出现异常.
FAILURE: Build failed with an exception.
出了什么问题:任务:app:transformNativeLibsWithMergeJniLibsForDebug"执行失败.
What went wrong: Execution failed for task ':app:transformNativeLibsWithMergeJniLibsForDebug'.
无法读取路径C:\REACT_NATIVE\AwesomeProject2\android\app\build\intermediates\transforms\mergeJniLibs\debug\0\lib\arm64-v8a".
Could not read path 'C:\REACT_NATIVE\AwesomeProject2\android\app\build\intermediates\transforms\mergeJniLibs\debug\0\lib\arm64-v8a'.
试试:使用 --stacktrace 选项运行以获取堆栈跟踪.使用 --info 或 --debug 选项运行以获得更多日志输出.使用 --scan 运行以获得完整的见解.
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.
在 57 秒内构建失败
BUILD FAILED in 57s
错误无法安装应用程序.确保您已设置 Android 开发环境:https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment.使用 --verbose 标志运行 CLI 以获取更多详细信息.错误:命令失败:gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
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:构建失败,出现异常.
FAILURE: Build failed with an exception.
出了什么问题:任务:app:transformNativeLibsWithMergeJniLibsForDebug"执行失败.
What went wrong: Execution failed for task ':app:transformNativeLibsWithMergeJniLibsForDebug'.
无法读取路径C:\REACT_NATIVE\AwesomeProject2\android\app\build\intermediates\transforms\mergeJniLibs\debug\0\lib\arm64-v8a".
Could not read path 'C:\REACT_NATIVE\AwesomeProject2\android\app\build\intermediates\transforms\mergeJniLibs\debug\0\lib\arm64-v8a'.
试试:使用 --stacktrace 选项运行以获取堆栈跟踪.使用 --info 或 --debug 选项运行以获得更多日志输出.使用 --scan 运行以获得完整的见解.
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.
在 57 秒内构建失败
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)
推荐答案
运行清洁任务为我解决了问题.在您项目的 android 目录中,使用 'clean' 运行 gradle 包装器
Running the cleaning task solved the problem for me. In your project's android dir, run gradle wrapper with 'clean'
cd android && ./gradlew clean
然后您可以返回项目目录并再次尝试运行.
Then you can go back to project dir and try running again.
cd .. && react-native run-android
这篇关于任务 :app:transformNativeLibsWithMergeJniLibsForDebug 失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!