【发布时间】:2017-07-13 11:01:33
【问题描述】:
我想使用 nativescript 创建一个小型 android 应用程序,但是在没有调试器的情况下这样做会使事情变得比必须的要慢得多。 因为它只是一个 JS 应用程序,所以我决定尝试一下 Visual Studio Code,至少在他们的教程视频中,它似乎可以很好地与 NativeScript 应用程序配合使用,但是当我尝试使用它时,它似乎并没有停止任何断点。这是我的 VSC 启动配置:
{
"name": "Launch on Android",
"type": "nativescript",
"request": "launch",
"platform": "android",
"appRoot": "${workspaceRoot}",
"sourceMaps": true,
"watch": true,
"tnsArgs": "--emulator"
}
我注意到,如果我将 "stopOnEntry": true 添加到此配置中,应用程序实际上会在开始时停止,但看起来 VSC 的调试器并没有真正附加到进程,因为“播放”按钮仍然处于禁用状态。
这是我的 package.json
{
"description": "NativeScript Application",
"license": "SEE LICENSE IN <your-license-filename>",
"readme": "NativeScript Application",
"repository": "<fill-your-repository-here>",
"scripts": {
"recreate": "rm -rf platforms && rm -rf node_modules && npm install && tns platform add android"
},
"nativescript": {
"id": "org.nativescript.forni",
"tns-android": {
"version": "2.5.1"
}
},
"dependencies": {
"lodash": "^4.17.4",
"nativescript-oauth": "^1.2.1",
"nativescript-telerik-ui": "^1.5.1",
"tns-core-modules": "2.4.4"
},
"devDependencies": {
"babel-traverse": "6.21.0",
"babel-types": "6.21.0",
"babylon": "6.15.0",
"lazy": "1.0.11"
}
}
这是我的 app.js,这是我希望打破的地方:
const application = require("application");
application.start({ moduleName: "views/login/login" });
我使用的是 Windows 10。我也尝试直接在我的三星 Galaxy S7 上运行该应用程序,但它的工作方式完全相同。
【问题讨论】:
-
我在 Ubuntu 上遇到了同样的问题,一旦它确实在设置的断点处停止,但似乎这是一个错误 :).. 我无法重现它。
标签: javascript android debugging visual-studio-code nativescript