如何调试Android应用程序从“亚行外壳日上午开始-D'开始了吗? [英] How to debug an android application started from 'adb shell am start -D '?

查看:247
本文介绍了如何调试Android应用程序从“亚行外壳日上午开始-D'开始了吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要调试已安装在手机上的Andr​​oid应用程序。我能够以调试模式启动应用程序,但我的不能连接到使用JDWP进程。我尝试两种不同的方式,都失败。 (见下文)


命令行尝试

1,启动应用程序

  [...] SDK \\平台工具>亚行-d壳上午开始-D -n包/ package.SomeActivity

应用程序启动和警报显示/!\\等待调试器。

2 - 打开一个端口JDWP

  [...] SDK \\平台工具>亚行转发TCP:8000 JDWP:7602

3尝试使用JDB连接

  [...] SDK \\平台工具>加多宝-attach 127.0.0.1:8000
    java.io.IOException异常:shmemBase_attach失败:
        在com.sun.tools.jdi.SharedMemoryTransportService.attach0(本机方法)
        在com.sun.tools.jdi.SharedMemoryTransportService.attach(SharedMemoryTransportService.java:108)
        在com.sun.tools.jdi.GenericAttachingConnector.attach(GenericAttachingConnector.java:116)
        在com.sun.tools.jdi.SharedMemoryAttachingConnector.attach(SharedMemoryAttachingConnector.java:63)
        在com.sun.tools.example.debug.tty.VMConnection.attachTarget(VMConnection.java:519)
        在com.sun.tools.example.debug.tty.VMConnection.open(VMConnection.java:328)
        在com.sun.tools.example.debug.tty.Env.init(Env.java:63)
        在com.sun.tools.example.debug.tty.TTY.main(TTY.java:1066)
致命错误:
无法连接到目标VM。


的IntelliJ尝试

我有配置我的本地项目启动默认的活动,并取消选中应用程序部署。

我也得到了应用程序启动时相同的警报可惜IDE无法连接到远程进程。

 目标设备:42f7cc14e2acbfab
启动应用程序:******** / ******** SomeActivity。
DEVICE shell命令:我开始-D -n。******** / ******** SomeActivity
首发:意向{CMP = ******** / ******** SomeActivity}等待的过程:********


解决方案

部署的应用程序是用的 可调试 属性设置为false。在移动电话上给出的提示只是误导。

I need to debug an android application that is already installed on a phone. I am able to start the application in debug mode but I can't connect to the process using JDWP. I have try two different ways that both fail. (see following sections)


Command line attempt

1- Start the application

[...]sdk\platform-tools>adb -d shell am start -D -n "package/package.SomeActivity"

The application starts and a alert display "/!\ Waiting for debugger".

2- Open a JDWP port

[...]sdk\platform-tools>adb forward tcp:8000 jdwp:7602

3- Attempt to connect using jdb

[...]sdk\platform-tools>jdb -attach 127.0.0.1:8000
    java.io.IOException: shmemBase_attach failed:
        at com.sun.tools.jdi.SharedMemoryTransportService.attach0(Native Method)
        at com.sun.tools.jdi.SharedMemoryTransportService.attach(SharedMemoryTransportService.java:108)
        at com.sun.tools.jdi.GenericAttachingConnector.attach(GenericAttachingConnector.java:116)
        at com.sun.tools.jdi.SharedMemoryAttachingConnector.attach(SharedMemoryAttachingConnector.java:63)
        at com.sun.tools.example.debug.tty.VMConnection.attachTarget(VMConnection.java:519)
        at com.sun.tools.example.debug.tty.VMConnection.open(VMConnection.java:328)
        at com.sun.tools.example.debug.tty.Env.init(Env.java:63)
        at com.sun.tools.example.debug.tty.TTY.main(TTY.java:1066)
Fatal error:
Unable to attach to target VM.


IntelliJ attempt

I have configure my local project to start the default Activity and uncheck the "Deploy application".

I also get the application started with the same alert but unfortunately the IDE doesn't connect to the remote process.

Target device: 42f7cc14e2acbfab
Launching application: ********/********.SomeActivity.
DEVICE SHELL COMMAND: am start -D -n "********/********.SomeActivity"
Starting: Intent { cmp=********/********.SomeActivity }

Waiting for process: ********

解决方案

The deployed application was configured with the debuggable attribute set to false. The prompt given on the mobile phone was simply misleading.

这篇关于如何调试Android应用程序从“亚行外壳日上午开始-D'开始了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆