在打开appium-desktop程序,点击inspector功能,填写app的配置信息,启动服务提示如下:
报错信息:
An unknown server-side error occurred while processing the command. Original error: Cannot start the 'cc.knowyourself.kymeditation' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Error executing adbExec. Original error: 'Command 'E:\\android-sdk-windows\\platform-tools\\adb.exe -P 5037 -s HBSBB18821510293 shell am start -W -n cc.knowyourself.kymeditation/.business.home.HomeActivity -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000' exited with code 4294967295'; Stderr: 'Security exception: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=cc.knowyourself.kymeditation/.business.home.HomeActivity } from null (pid=14487, uid=2000) not exported from uid 10152 java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=cc.knowyourself.kymeditation/.business.home.HomeActivity } from null (pid=14487, uid=2000) not exported from uid 10152 at com.android.server.am.ActivityStackSupervisor.checkStartAnyActivityPermission(ActivityStackSupervisor.java:2028) at com.android.server.am.ActivityStarter.startActivity(ActivityStarter.java:931) at com.android.server.am.ActivityStarter.startActivity(ActivityStarter.java:656) at com.android.server.am.HwActivityStarter.startActivity(HwActivityStarter.java:235) at com.android.server.am.ActivityStarter.startActivityMayWait(ActivityStarter.java:1492) at com.android.server.am.HwActivityStarter.startActivityMayWait(HwActivityStarter.java:430) at com.android.server.am.ActivityStarter.execute(ActivityStarter.java:597) at com.android.server.am.ActivityManagerService.startActivityAndWait(ActivityManagerService.java:5911) at com.android.server.am.ActivityManagerShellCommand.runStartActivity(ActivityManagerShellCommand.java:474) at com.android.server.am.ActivityManagerShellCommand.onCommand(ActivityManagerShellCommand.java:161) at android.os.ShellCommand.exec(ShellCommand.java:103) at com.android.server.am.ActivityManagerService.onShellCommand(ActivityManagerService.java:17786) at android.os.Binder.shellCommand(Binder.java:642) at android.os.Binder.onTransact(Binder.java:540) at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:3570) at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3654) at com.android.server.am.HwActivityManagerService.onTransact(HwActivityManagerService.java:609) at android.os.Binder.execTransact(Binder.java:739)'; Code: '4294967295'
出现这样的错误一定是因为当前的appActivity设置的不是app首次进入的appActivity
解决方法:
获取首次应用的活动名称可以通过 启动一次随机 monkey命令来获取
adb shell monkey -p 包名 -v -v -v 1
在把上图中的包名和activity名称复制下来,放到inspector的app配置信息中,再次启动即可
总结:
感谢每一个认真阅读我文章的人!!!
作为一位过来人也是希望大家少走一些弯路,如果你不想再体验一次学习时找不到资料,没人解答问题,坚持几天便放弃的感受的话,在这里我给大家分享一些自动化测试的学习资源,希望能给你前进的路上带来帮助。