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的项目里没有这段逻辑

相关推荐
写代码的小阿帆8 分钟前
AI工具使用——外挂AI插件、AI原生IDE与AI终端
ide·人工智能·ai-native
YaBingSec1 小时前
玄机靶场-2024ccb初赛sc05 WP
android·运维·网络·笔记·安全·ssh
常利兵1 小时前
解锁Android嵌入式照片选择器,让你的App体验丝滑起飞
android
峥嵘life2 小时前
Android 切换用户后无法获取 MAC 地址分析解决
android·python·macos
JJay.2 小时前
Android BLE 为什么连上了却收不到数据
android
歪楼小能手2 小时前
Android16在开机向导最后添加一个声明界面
android·java·平板
夏沫琅琊2 小时前
Android联系人导入导出
android·kotlin
zh_xuan2 小时前
把Android Library 上传到github并在工程中引用该远程仓库
android·github·远程仓库
诸神黄昏EX2 小时前
Android Google MADA
android
盖丽男2 小时前
使用 GitHub Actions 自动打包 Android APK
android·github