adb查找被测应用app

1、前提,连接上你的移动设备

2、打开被测应用app

3、输入adb命令,查看对应的包名和activity

adb shell dumpsys window | findstr mCurrentFocus

adb shell dumpsys activity | findstr mFocusedActivity

样张

mCurrentFocus=Window{4fa8d9a u0 com.xxx.xxxxx/com.xxx.xxxxx.main.ui.activity.MainActivity}

4、启动对应的包名和activity

adb shell am start -n com.xxx.xxxxx/com.xxx.xxxxx.main.ui.activity.MainActivity

5、提示没有权限

Android组件中有个 exported 属性,见官方文档描述:

Flag indicating whether the given application component is available to other applications. If false, it can only be accessed by applications with its same user id (which usually means only by code in its own package). If true, it can be invoked by external entities, though which ones can do so may be controlled through permissions. The default value is false for activity, receiver, and service components that do not specify any intent filters; it is true for activity, receiver, and service components that do have intent filters (implying they expect to be invoked by others who do not know their particular component name) and for all content providers.

当组件没有intent-filter时exported 属性默认为false,此组件只能由本应用用户访问,配备了intent-filter后此值改变为true,允许外部调用

你可能感兴趣的:(adb查找被测应用app)