admin管理员组文章数量:1336215
I am trying to interactively debug system Android applications in the Android 14 and Android 15 emulator such as com.android.phone
but I am unable to connect via JDWP.
My host PC is:
Ubuntu 22.04.5 LTS
Linux 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
In Android 14 emulator it hangs on running adb jdwp
and errors out when trying to connect:
$ adb shell getprop | grep ro.build.fingerprint
[ro.build.fingerprint]: [Android/sdk_phone64_x86_64/emu64x:14/UE1A.230829.036.A1/11228894:userdebug/test-keys]
$ adb forward --remove-all
$ adb forward tcp:5005 jdwp:1161
$ adb forward --list
emulator-5554 tcp:5005 jdwp:1161
$ adb jdwp
... hangs forever ...
$ jdb -attach localhost:5005
java.io.IOException: handshake failed - connection prematurally closed
at com.sun.tools.jdi.SocketTransportService.handshake(SocketTransportService.java:136)
at com.sun.tools.jdi.SocketTransportService.attach(SocketTransportService.java:232)
at com.sun.tools.jdi.GenericAttachingConnector.attach(GenericAttachingConnector.java:116)
at com.sun.tools.jdi.SocketAttachingConnector.attach(SocketAttachingConnector.java:90)
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:1083)
Fatal error:
Unable to attach to target VM.
In Android 13 emulator the same commands work:
$ adb shell getprop | grep ro.build.fingerprint
[ro.build.fingerprint]: [Android/sdk_phone64_x86_64/emulator64_x86_64:13/TE1A.220922.034/10940250:userdebug/test-keys]
$ adb forward --remove-all
$ adb forward tcp:5005 jdwp:961
$ adb forward --list
emulator-5554 tcp:5005 jdwp:961
$ adb jdwp
603
... etc ...
$ jdb -attach localhost:5005
Set uncaught java.lang.Throwable
Set deferred uncaught java.lang.Throwable
Initializing jdb ...
>
I am trying to interactively debug system Android applications in the Android 14 and Android 15 emulator such as com.android.phone
but I am unable to connect via JDWP.
My host PC is:
Ubuntu 22.04.5 LTS
Linux 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
In Android 14 emulator it hangs on running adb jdwp
and errors out when trying to connect:
$ adb shell getprop | grep ro.build.fingerprint
[ro.build.fingerprint]: [Android/sdk_phone64_x86_64/emu64x:14/UE1A.230829.036.A1/11228894:userdebug/test-keys]
$ adb forward --remove-all
$ adb forward tcp:5005 jdwp:1161
$ adb forward --list
emulator-5554 tcp:5005 jdwp:1161
$ adb jdwp
... hangs forever ...
$ jdb -attach localhost:5005
java.io.IOException: handshake failed - connection prematurally closed
at com.sun.tools.jdi.SocketTransportService.handshake(SocketTransportService.java:136)
at com.sun.tools.jdi.SocketTransportService.attach(SocketTransportService.java:232)
at com.sun.tools.jdi.GenericAttachingConnector.attach(GenericAttachingConnector.java:116)
at com.sun.tools.jdi.SocketAttachingConnector.attach(SocketAttachingConnector.java:90)
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:1083)
Fatal error:
Unable to attach to target VM.
In Android 13 emulator the same commands work:
$ adb shell getprop | grep ro.build.fingerprint
[ro.build.fingerprint]: [Android/sdk_phone64_x86_64/emulator64_x86_64:13/TE1A.220922.034/10940250:userdebug/test-keys]
$ adb forward --remove-all
$ adb forward tcp:5005 jdwp:961
$ adb forward --list
emulator-5554 tcp:5005 jdwp:961
$ adb jdwp
603
... etc ...
$ jdb -attach localhost:5005
Set uncaught java.lang.Throwable
Set deferred uncaught java.lang.Throwable
Initializing jdb ...
>
Share
edited Nov 19, 2024 at 21:58
satur9nine
asked Nov 19, 2024 at 20:25
satur9ninesatur9nine
15.1k5 gold badges90 silver badges131 bronze badges
1 Answer
Reset to default 0It appears that Google changed AOSP starting with Android 14 to make userdebug
builds produce system APKs that do not have debuggable
set to true in the manifest. It can be verified by running adb shell dumpsys package
.
This makes it impossible to use JDWP to connect adn debug system apps due to this code in jdwp_service.cpp
:
// Don't allow JDWP connection to a non-debuggable process.
if (!proc->process.debuggable) continue;
Perhaps there is some work-around for a prebuilt userdebug
emulator (we do have root after all), but I don't know of one off-hand.
For now I am building my own eng
build AOSP emulator and I'm able to debug system apps with that.
本文标签: adbSystem app JDWP debugging broken in Android emulator 14 and 15Stack Overflow
版权声明:本文标题:adb - System app JDWP debugging broken in Android emulator 14 and 15 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742400714a2467827.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论