首页 > 解决方案 > 如何为 Nativescript 捆绑运行 android

问题描述

当我按照步骤使用 Angular 将 Web 项目迁移到代码共享时,在执行 tns run android --bundle 之后,出现以下错误:

ERROR in Could not resolve module C:\Ideas\Source\b2bAngular\src\app.module

Webpack 编译完成。监视文件更改。Webpack 构建完成!从 C:\Ideas\Source\b2bAngular\hooks\before-shouldPrepare\nativescript-dev-webpack.js 执行 before-shouldPrepare 挂钩 从 C:\Ideas\Source\b2bAngular\hooks\before-cleanApp\nativescript 执行 before-cleanApp 挂钩-dev-webpack.js 正在准备项目...从 C:\Ideas\Source\b2bAngular\hooks\before-prepareJSApp\nativescript-dev-webpack.js 执行 before-prepareJSApp 钩子... + 设置 applicationId + 应用用户- 从 C:\Ideas\Source\b2bAngular\App_Resources\Android\app.gradle 定义配置 + 添加 nativescript 运行时包依赖项:nativescript-optimized-with-inspector + 添加 aar 插件依赖项:C:\Ideas\Source\b2bAngular\node_modules \tns-core-modules-widgets\platforms\android\widgets-release.aar

FAILURE:构建失败并出现异常。

4 秒内构建失败无法在设备上应用更改:c1f7d849。错误是:命令 gradlew.bat 失败,退出代码为 1。从 C:\Ideas\Source\b2bAngular\hooks\after-watch\nativescript-dev-webpack.js 执行监视后挂钩C:\Ideas\Source\b2bAngular\hooks\after-watch\nativescript-dev-webpack.js

任何帮助都非常感谢!

标签: androidnativescriptnativescript-angular

解决方案


当我再次启动该过程时它起作用了,但是这次我没有执行 update-ns-webpack 脚本,它起作用了。

所以我开始了一个执行该脚本的新项目,但它没有工作,但是当我创建一个新项目而不执行它时,一切都很完美。

我认为与该脚本有关


推荐阅读