Ionic 2:在android设备上运行的应用程序无法调试 [英] Ionic 2: Application running on the android device can't be debugged
问题描述
重现步骤:
1.从
创建新项目
这里是我使用的:
Cordova CLI:6.4.0
Ionic Framework版本:2.0.0-rc.4
Ionic CLI版本:2.1.18
Ionic App Lib版本:2.1.9
Ionic应用程序脚本版本:0.0.48
ios-deploy版本:1.9.0
ios-sim版本:5.0.13
操作系统:macOS Sierra
节点版本:v6.9.2
Xcode版本:Xcode 8.2.1版本8C1002
<我设法找出导致问题和如何解决它的原因。问题是,当你在Android设备上进行远程调试时,Chrome调试器无法访问设备上的源映射文件。解决方案/修复是包括源映射内联。为此,我:
将以下添加到根项目目录中的package.json
config:{
ionic_bundler:webpack,
ionic_source_map_type:#inline-source-map
} / code>
这是为了使webpack添加源映射inline
更改tsconfig.js行
sourceMap:true,
到
sourceMap:false
这是禁用typescript创建源映射文件,因为这是由webpack完成。
工作得很好
Steps to reproduce: 1. Created new project from https://github.com/driftyco/ionic-starter-super 2. run `ionic run android`` 3. use chrome://inspect to debug
There is no ts and debug is not working - see attached
Here is what I'm using: Cordova CLI: 6.4.0 Ionic Framework Version: 2.0.0-rc.4 Ionic CLI Version: 2.1.18 Ionic App Lib Version: 2.1.9 Ionic App Scripts Version: 0.0.48 ios-deploy version: 1.9.0 ios-sim version: 5.0.13 OS: macOS Sierra Node Version: v6.9.2 Xcode version: Xcode 8.2.1 Build version 8C1002
I managed to find out what was causing the problem and how to solve it. The problem was that when you're remote debugging on an android device, Chrome debugger cannot access the source map file on the device. The solution/fix is to include the source map inline. To do this I:
added the below to package.json in the root project directory
"config": {
"ionic_bundler": "webpack",
"ionic_source_map_type": "#inline-source-map"
},
This is to make the webpack to add source maps inline changed tsconfig.js line
"sourceMap": true,
to
"sourceMap": false
This is to disable typescript to create source map file since this is done by webpack.
After this change everything seems to be working fine
这篇关于Ionic 2:在android设备上运行的应用程序无法调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!