输入adb命令获取package以及activity,启动appium报以下错误
UnknownError: An unknown server-side error occurred while processing the command. Original error: Cannot start the 'com.honyarandroid.smarthome' 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 'D:\\Android-SDK\\androidsdk\\platform-tools\\adb.exe -P 5037 -s 95f300a0 shell am start -W -n com.honyarandroid.smarthome/com.mxchip.honyarandroid.aep.living.page.ilopmain.MainActivity -S' exited with code 255'; Stderr: 'Security exception: Permission Denial: starting Intent { flg=0x10000000 cmp=com.honyarandroid.smarthome/com.mxchip.honyarandroid.aep.living.page.ilopmain.MainActivity } from null (pid=16609, uid=2000) not exported from uid 10834
java.lang.SecurityException: Permission Denial: starting Intent { flg=0x10000000 cmp=com.honyarandroid.smarthome/com.mxchip.honyarandroid.aep.living.page.ilopmain.MainActivity } from null (pid=16609, uid=2000) not exported from uid 10834
查了网上的资料,原因是因为不能直接挂起查到的activity,而是要启动第一次进入的activity
#获取首次应用的活动名称可以通过 启动一次随机 monkey命令来获取
adb shell monkey -p 包名 -v -v -v 1
之后启动便不会报错了