在android上运行时,反应本机捆绑的js失败了

时间:2017-10-10 11:58:32

标签: javascript android react-native

在打包器中,当我运行命令时,我收到以下错误

react-native run-android

打包器输出为:

2017-10-16T11:18:46.7198274Z ValidateSolutionConfiguration:
2017-10-16T11:18:46.7198274Z   Building solution configuration "dev|any cpu".
2017-10-16T11:18:46.7823299Z Project "D:\agent4\_work\1\s\**********.Deployment\Deployment.sln" (1) is building "D:\agent4\_work\1\s\**********.Deployment\AzureResourceGroup\AzureResourceGroup.deployproj" (2) on node 1 (Publish target(s)).
2017-10-16T11:18:46.7823299Z PrepareForBuild:
2017-10-16T11:18:46.7823299Z   Creating directory "bin\Dev\".
2017-10-16T11:18:46.7823299Z   Creating directory "obj\Dev\".
2017-10-16T11:18:46.7979556Z ##[error]C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(3608,5): Error MSB3030: Could not copy the file "obj\Dev\AzureResourceGroup.exe" because it was not found.
2017-10-16T11:18:46.7979556Z C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(3608,5): error MSB3030: Could not copy the file "obj\Dev\AzureResourceGroup.exe" because it was not found. [D:\agent4\_work\1\s\**********.Deployment\AzureResourceGroup\AzureResourceGroup.deployproj]
2017-10-16T11:18:46.7979556Z Done Building Project "D:\agent4\_work\1\s\**********.Deployment\AzureResourceGroup\AzureResourceGroup.deployproj" (Publish target(s)) -- FAILED.
2017-10-16T11:18:46.8135812Z Project "D:\agent4\_work\1\s\**********.Deployment\Deployment.sln" (1) is building "D:\agent4\_work\1\s\**********.Deployment\Scripts\Scripts.pssproj" (3) on node 1 (Publish target(s)).
2017-10-16T11:18:46.8135812Z PrepareForBuild:
2017-10-16T11:18:46.8135812Z   Creating directory "bin\Debug\".
2017-10-16T11:18:46.8135812Z   Creating directory "obj\Debug\".
2017-10-16T11:18:47.0635934Z ##[error]C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(3608,5): Error MSB3030: Could not copy the file "obj\Debug\MyApplication.exe" because it was not found.
2017-10-16T11:18:47.0635934Z C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(3608,5): error MSB3030: Could not copy the file "obj\Debug\MyApplication.exe" because it was not found. [D:\agent4\_work\1\s\**********.Deployment\Scripts\Scripts.pssproj]
2017-10-16T11:18:47.0635934Z Done Building Project "D:\agent4\_work\1\s\**********.Deployment\Scripts\Scripts.pssproj" (Publish target(s)) -- FAILED.
2017-10-16T11:18:47.0635934Z Done Building Project "D:\agent4\_work\1\s\**********.Deployment\Deployment.sln" (Publish target(s)) -- FAILED.
2017-10-16T11:18:47.0635934Z 
2017-10-16T11:18:47.0635934Z Build FAILED.

有任何帮助吗?提前谢谢。

2 个答案:

答案 0 :(得分:6)

尝试重新运行项目并清理项目,cd android然后gradlew clean,我建议先运行react-native start,然后打开一个新终端并运行{{1}我也找到了非常相似的故障排除案例,https://facebook.github.io/react-native/docs/troubleshooting.html#unable-to-start-react-native-package-manager-on-linux希望有所帮助:)

答案 1 :(得分:1)

我按照以下步骤操作:

  • 终止在8081端口上启动的节点服务器进程。
  • 重新启动我的完整开发环境
  • 然后以超级用户启动我的打包程序(react-native start
  • 然后执行react-native run-android

现在它已成功运行。