使用adb命令安装包名的时候报错了
我是直接用 adb shell dumpsys window | findstr mCurrentFocus 获取的
获取到了这一段: uni.UNIDD11F28/io.dcloud.PandoraEntryActivity
但是我用这一段准备打开app的时候报错了
C:Usersadmin>adb shell am start uni.UNIDD11F28/io.dcloud.PandoraEntryActivity Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=uni.UNIDD11F28/io.dcloud.PandoraEntryActivity } Security exception: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=uni.UNIDD11F28/io.dcloud.PandoraEntryActivity } from null (pid=26830, uid=2000) not exported from uid 10233 java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=uni.UNIDD11F28/io.dcloud.PandoraEntryActivity } from null (pid=26830, uid=2000) not exported from uid 10233 at com.android.server.wm.ActivityStackSupervisor.checkStartAnyActivityPermission(ActivityStackSupervisor.java:1089) at com.android.server.wm.ActivityStarter.startActivity(ActivityStarter.java:789) at com.android.server.wm.ActivityStarter.startActivity(ActivityStarter.java:588) at com.android.server.wm.ActivityStarter.startActivityMayWait(ActivityStarter.java:1390) at com.android.server.wm.ActivityStarter.execute(ActivityStarter.java:519) at com.android.server.wm.ActivityTaskManagerService.startActivityAsUser(ActivityTaskManagerService.java:1091) at com.android.server.wm.ActivityTaskManagerService.startActivityAsUser(ActivityTaskManagerService.java:1065) at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:3569) at com.android.server.am.ActivityManagerShellCommand.runStartActivity(ActivityManagerShellCommand.java:518) at com.android.server.am.ActivityManagerShellCommand.onCommand(ActivityManagerShellCommand.java:172) at android.os.ShellCommand.exec(ShellCommand.java:104) at com.android.server.am.ActivityManagerService.onShellCommand(ActivityManagerService.java:10093) at android.os.Binder.shellCommand(Binder.java:881) at android.os.Binder.onTransact(Binder.java:765) at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:4727) at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2799) at android.os.Binder.execTransactInternal(Binder.java:1021) at android.os.Binder.execTransact(Binder.java:994)
然后再网上查阅资料发现,我们获取到的活动入口可能不是真正的入口
解决问题方案如下:
1.我们通过拿到包名去获取包的详细信息
adb shell
dumpsys package uni.UNIDD11F28
我标记出来的为真正的包名
2.重新打开app
adb shell am start uni.UNIDD11F28/io.dcloud.PandoraEntry
引用文章:https://blog.csdn.net/yangsummer2426/article/details/80929869
adb shell dumpsys window | findstr mCurrentFocus