-
出现的异常
android studio 编译 React-Native 项目时出现 Process 'command 'node'' finished with non-zero exit value 1
且如图所示:{...路径地址}/{项目名称}/android/app/build/intermediates/assets/debug/CodePushHash'
原因:这是由于gradle plugin 插件升级3.2.1后使用了新的 intermediates/merged_assets 目录替代了 intermediates/assets 目录造成编译不通过
解决办法:找到文件目录{project_dir}/node_modules/react-native-code-push/android/codepush.gradle (~86-90行左右)
generateBundledResourcesHash = tasks.create(
name: "generateBundledResourcesHash${targetName}",
type: Exec) {
//加入以下三行
doFirst {
jsBundleDir.mkdirs()
}
commandLine (*nodeExecutableAndArgs, "${nodeModulesPath}/react-native-code-push/scripts/generateBundledResourcesHash.js", resourcesDir, jsBundleFile, jsBundleDir, resourcesMapTempFileName)
}
即可