Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/219.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 我如何获得与苏执行推荐的内容?_Android_Robotium_Android Uiautomator - Fatal编程技术网

Android 我如何获得与苏执行推荐的内容?

Android 我如何获得与苏执行推荐的内容?,android,robotium,android-uiautomator,Android,Robotium,Android Uiautomator,当我执行推荐时,比如am start-W-ncom.xxx.xxx/.xxx活动 我可以看到内容。 开始:Intent{cmp=com.xxx.xxx/.xxActivity} 状态:ok 活动:com.xxx.xxx/.xxActivity 这次:52 总时间:71 完整的 但是当我对su执行一个命令时,比如su-c am start-W-n com.xxx.xxx/.xxActivity 没有要输出的内容,如何使用su获得输出?如果运行正常,标准安卓su可以正常工作: $ su 0 am

当我执行推荐时,比如am start-W-ncom.xxx.xxx/.xxx活动 我可以看到内容。 开始:Intent{cmp=com.xxx.xxx/.xxActivity} 状态:ok 活动:com.xxx.xxx/.xxActivity 这次:52 总时间:71 完整的

但是当我对su执行一个命令时,比如su-c am start-W-n com.xxx.xxx/.xxActivity 没有要输出的内容,如何使用su获得输出?

如果运行正常,标准安卓su可以正常工作:

 $ su 0 am start -W -n com.android.settings/.Settings
Starting: Intent { cmp=com.android.settings/.Settings }
Warning: Activity not started, its current task has been brought to the front
Status: ok
Activity: com.android.settings/.Settings
ThisTime: 0
TotalTime: 0
Complete
下面是代码的摘录:


如果在不使用su的情况下获取输出,为什么要使用su?因为某些活动需要su来启动或获取异常java.lang.SecurityException:权限拒绝:
/*
 * SU can be given a specific command to exec. UID _must_ be
 * specified for this (ie argc => 3).
 *
 * Usage:
 *   su 1000
 *   su 1000 ls -l
 *  or
 *   su [uid[,gid[,group1]...] [cmd]]
 *  E.g.
 *  su 1000,shell,net_bw_acct,net_bw_stats id
 * will return
 *  uid=1000(system) gid=2000(shell) groups=3006(net_bw_stats),3007(net_bw_acct)
 */