電話に既にインストールされている Android アプリケーションをデバッグする必要があります。アプリケーションをデバッグ モードで起動できますが、JDWP を使用してプロセスに接続できません。どちらも失敗する2つの異なる方法を試しました。(次のセクションを参照)
コマンドラインの試み
1- アプリケーションを起動します
[...]sdk\platform-tools>adb -d shell am start -D -n "package/package.SomeActivity"
アプリケーションが起動し、「/!\ Waiting for debugger」というアラートが表示されます。
2- JDWP ポートを開く
[...]sdk\platform-tools>adb forward tcp:8000 jdwp:7602
3- 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 の試み
デフォルトのアクティビティを開始するようにローカル プロジェクトを構成し、[Deploy application] のチェックを外しました。
私も同じアラートでアプリケーションを起動しますが、残念ながら IDE はリモート プロセスに接続しません。
Target device: 42f7cc14e2acbfab
Launching application: ********/********.SomeActivity.
DEVICE SHELL COMMAND: am start -D -n "********/********.SomeActivity"
Starting: Intent { cmp=********/********.SomeActivity }
Waiting for process: ********