Ham*_*mid 17 javascript android gradle react-native
当我运行./gradlew assembleRelease构建失败时出现此错误:
Run Code Online (Sandbox Code Playgroud)Error:Execution failed for task ':app:bundleReleaseJsAndAssets. > A problem occurred starting process 'command 'node'
我在互联网上搜索并找到了一些关于它的主题,但我无法解决我的问题.
React-Native版本:0.54.0
编辑:
现在我./gradlew assembleRelease --info从终端而不是Android Studio运行,我得到不同的错误.
结果如下:
> Task :app:processReleaseResources
Putting task artifact state for task ':app:processReleaseResources' into context took 0.007 secs.
file or directory '**/android/app/libs', not found
file or directory '**/node_modules/appcenter-crashes/android/libs', not found
file or directory '**/node_modules/appcenter-analytics/android/libs', not found
file or directory '**/node_modules/appcenter/android/libs', not found
file or directory '**/node_modules/react-native-interactable/lib/android/libs', not found
file or directory '**/node_modules/react-native-navigation/android/app/libs', not found
file or directory '**/android/app/libs', not found
file or directory '**/node_modules/appcenter-crashes/android/libs', not found
file or directory '**/appcenter-analytics/android/libs', not found
file or directory '**/node_modules/appcenter/android/libs', not found
file or directory '**/node_modules/react-native-interactable/lib/android/libs', not found
file or directory '**/node_modules/react-native-navigation/android/app/libs', not found
Executing task ':app:processReleaseResources' (up-to-date check took 0.035 secs) due to:
Task has failed previously.
All input files are considered out-of-date for incremental task ':app:processReleaseResources'.
Unable do incremental execution: full task run
file or directory '**/android/app/libs', not found
file or directory '**/node_modules/appcenter-crashes/android/libs', not found
file or directory '**/node_modules/appcenter-analytics/android/libs', not found
file or directory '**/node_modules/appcenter/android/libs', not found
file or directory '**/node_modules/react-native-interactable/lib/android/libs', not found
file or directory '**/node_modules/react-native-navigation/android/app/libs', not found
file or directory '**/android/app/libs', not found
file or directory '**/node_modules/appcenter-crashes/android/libs', not found
file or directory '**/node_modules/appcenter-analytics/android/libs', not found
file or directory '**/node_modules/appcenter/android/libs', not found
file or directory '**/node_modules/react-native-interactable/lib/android/libs', not found
file or directory '**/node_modules/react-native-navigation/android/app/libs', not found
Aapt2QueuedResourceProcessor is using **/Android/sdk/build-tools/26.0.2/aapt2
Failed to execute aapt
com.android.ide.common.process.ProcessException: Failed to execute aapt
*
*
*
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processReleaseResources'.
> Failed to execute aapt
Run Code Online (Sandbox Code Playgroud)
似乎gradle正在所有模块中查找libs文件夹,但节点模块中没有libs文件夹.这是真的,但我不知道为什么gradle正在寻找libs文件夹.
小智 40
第一:
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
Run Code Online (Sandbox Code Playgroud)
最后建立:
./gradlew assembleRelease -x bundleReleaseJsAndAssets
Run Code Online (Sandbox Code Playgroud)
Mik*_*keL 15
对我来说,创建包失败了,但我注意到Sahin Elidemir 的这条评论:
只是 ./gradlew assembleRelease -x bundleReleaseJsAndAssets 救了我。
它几乎对我有用。最后有效的是(注意app:,对我来说它没有失败,并且是一个clean很好的衡量标准):
./gradlew clean app:assembleRelease -x bundleReleaseJsAndAssets
Run Code Online (Sandbox Code Playgroud)
Qui*_*inn 15
我遇到了同样的问题,解决方案是:
cd到你的App/android文件夹
运行这个
./gradlew --stop
进而
./gradlew assembleRelease
这将构建您的应用程序。
构建完成后,查看您的应用程序(apk)。
android\app\build\outputs\apk\release
小智 10
看来您尚未制作js捆绑包,因此请首先使用以下命令制作捆绑包:-
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
Run Code Online (Sandbox Code Playgroud)
然后在您的项目目录中
cd android
Run Code Online (Sandbox Code Playgroud)
清理你的摇篮
./gradlew clean
Run Code Online (Sandbox Code Playgroud)
并最终建立
./gradlew assembleDebug
Run Code Online (Sandbox Code Playgroud)
尝试这个。希望对您有帮助。
这对我有用,请按照以下步骤操作:-
1) 停止运行 Gradle
$ cd RectNatoveProjectName & cd android (Open your project and go to android folder)
$ ./gradlew --stop (Run this command to stop old running Gradle service )
Run Code Online (Sandbox Code Playgroud)
2)更新android应用程序构建gradle
project.ext.react = [
nodeExecutableAndArgs : ["/usr/local/bin/node"]
];
Run Code Online (Sandbox Code Playgroud)
3)获取节点详细信息
$ which node
Run Code Online (Sandbox Code Playgroud)
> (结果将类似于“/usr/username/.nvm/versions/node/v10.7.0/bin/node”)
4)链接节点(非常重要的步骤复制上述步骤3中的结果)
- ln -s /usr/username/.nvm/versions/node/v10.7.0/bin/node /usr/local/bin/node
Run Code Online (Sandbox Code Playgroud)
5) 如果步骤 - 4 返回文件存在 - 则转到文件夹 /usr/local/bin/ 并删除“node”文件并再次执行步骤 -4。
6) 如果步骤 4 成功运行,则该节点问题将得到解决。
小智 6
只是使用./gradlew --stop然后./gradlew assembleRelease为我工作。
| 归档时间: |
|
| 查看次数: |
22808 次 |
| 最近记录: |