Android studio “Layout Inspector“工具在Android14 userdebug设备无法正常使用

背景描述

做rom开发的都知道,"Layout Inspector"和"Attach Debugger to Android Process"是studio里很好用的工具,可以用来查看布局、调试系统进程(比如setting、launcher、systemui)。

问题描述

最进刚开始一个Android 14的项目,刷userdebug版本后,发现"Layout Inspector"和"Attach Debugger to Android Process"都无法正常使用,它像user版本一样看不到系统的进程。

拿出前半年做的Android 13 userdebug设备发现可以正常使用。

于是创建了1个Google case,请求帮助。

解决方案

在经过几轮log和截图后,google同事给出了反馈:

Thanks for the extra details.

From Android 14 if you need to debug a Java process which isn't a debuggable app , and are using an userdebug build, you also need to enable JDWP by running the following commands

java 复制代码
adb shell setprop persist.debug.dalvik.vm.jdwp.enabled 1
adb reboot

This change was made by the platform (Android), not by Layout Inspector.

Let me know if this fixes your problem.

验证之后是有效的,Android 14 userdebug版本的设备可以使用"Layout Inspector"和"Attach Debugger to Android Process"工具了,又可以快乐的调试系统进程了。

问题原因

在源码搜索persist.debug.dalvik.vm.jdwp.enabled 发现是Google新加的代码。

在之前Android 13的项目里没有这段逻辑

相关推荐
alexhilton1 小时前
使用FunctionGemma进行设备端函数调用
android·kotlin·android jetpack
冬奇Lab4 小时前
InputManagerService:输入事件分发与ANR机制
android·源码阅读
张小潇7 小时前
AOSP15 Input专题InputManager源码分析
android·操作系统
RdoZam10 小时前
Android-封装基类Activity\Fragment,从0到1记录
android·kotlin
奥陌陌15 小时前
android 打印函数调用堆栈
android
用户9851200358315 小时前
Compose Navigation 3 深度解析(二):基础用法
android·android jetpack
恋猫de小郭15 小时前
Android 官方正式官宣 AI 支持 AppFunctions ,Android 官方 MCP 和系统级 OpenClaw 雏形
android·前端·flutter
黄林晴16 小时前
Android 17 Beta 2,隐私这把锁又拧紧了
android
Kapaseker16 小时前
研究表明,开发者对Kotlin集合的了解不到 20%
android·kotlin
bqliang17 小时前
Compose 媒体查询 (Media Query API) 🖱️👇🕹️
android·android jetpack