问题描述
我想发布 apk 但我收到错误 - 文件已经存在,mkdir 'D:\mobile'.它在 d 驱动器中生成名为 mobile 的文件.删除文件后,再次执行 gradlew assembleRelease 创建此文件并抛出错误.
i want to release the apk but im getting error -file already exists, mkdir 'D:\mobile'.its generating file nameed mobile in the d drive. after deleting the file , executing gradlew assembleRelease again creating this file and throwing error.
任务:app:bundleReleaseJsAndAssets警告:转换缓存已重置.加载依赖图,完成.info 将包输出写入到:, D:\mobileinfo 将 sourcemap 输出写入:, D:\mobileinfo 完成写入包输出info 完成编写 sourcemap 输出info 复制 24 个资产文件错误 EEXIST:文件已存在,mkdir 'D:\mobile'.使用 --verbose 标志运行 CLI 以获取更多详细信息.错误:EEXIST:文件已经存在,mkdir 'D:\mobile'
任务:app:bundleReleaseJsAndAssets 失败
Task :app:bundleReleaseJsAndAssets FAILED
FAILURE:构建失败,出现异常.
FAILURE: Build failed with an exception.
出了什么问题:任务:app:bundleReleaseJsAndAssets"执行失败.
What went wrong:Execution failed for task ':app:bundleReleaseJsAndAssets'.
进程 'command'npx.cmd'' 以非零退出值 1 结束
试试:使用 --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.
推荐答案
在你的场景中,我认为你还没有制作一个 js 包,所以请先使用命令制作一个包
In your scenario I think you haven't made a js bundle so please make a bundle first by using command
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
之后,使用 cd android
在进行发布构建之前,请确保使用 ./gradlew clean
Before make release build make sure to clean your gradle using ./gradlew clean
最后运行这个命令 ./gradlew assembleRelease -x bundleReleaseJsAndAssets
这篇关于使用 gradlew assembleRelease 从 React Native 创建发布 apk 时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!