Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/226.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
adb如何在android上启动守护进程_Android_Android Ndk_Adb_Adb Shell - Fatal编程技术网

adb如何在android上启动守护进程

adb如何在android上启动守护进程,android,android-ndk,adb,adb-shell,Android,Android Ndk,Adb,Adb Shell,你能帮帮我吗,我的头肿了 我正在尝试通过命令在android emu/设备上运行守护程序: adb -s <device_name> shell su -c /dir/daemon <port_number> adb-s shell su-c/dir/daemon 但是什么都没有发生,也没有错误 如果我这样做: adb -s <device> shell adb-s外壳 然后形成shell命令行: su -c /dir/daemon <port_

你能帮帮我吗,我的头肿了

我正在尝试通过命令在android emu/设备上运行守护程序:

adb -s <device_name> shell su -c /dir/daemon <port_number>
adb-s shell su-c/dir/daemon
但是什么都没有发生,也没有错误

如果我这样做:

adb -s <device> shell
adb-s外壳
然后形成shell命令行:

su -c /dir/daemon <port_number>
su-c/dir/daemon
比它的工作好。我尝试使用shell脚本并运行:

adb -s <device_name> shell sh su -c /dir/script.sh <port_number>
adb-s shell sh su-c/dir/script.sh
我甚至尝试从Qt代码生成带有端口号的脚本,并使用:

adb -s <device_name> shell sh su -c /dir/script.sh
adb-s shell sh su-c/dir/script.sh
但这并没有帮助。。。问题是,如果我进入adb外壳之前运行守护程序-它的工作。另一个问题是在不同的设备/emu/iso_映像上,不同的命令格式无法工作。例如:

adb -s <device_name> shell su -c /dir/daemon <port_number> // work at emu, but not at iso
adb-s shell su-c/dir/daemon//在emu工作,但不在iso工作
反之亦然:

adb -s <device_name> shell su -c "/dir/daemon <port_number>" // work at iso
adb-s shell su-c”/dir/daemon//在iso工作
等等

每个人都能回答怎么了

对不起,我的英语是

adb shell su-c”/dir>/dev/null 2>/dev/nulladb shell su -c "/dir > /dev/null 2> /dev/null < /dev/null &"

shell su-c/data/local/tmp/start\u daemon.sh #!/系统/bin/sh /数据/本地/tmp/nohup /数据/本地/tmp/守护进程和
shell su -c /data/local/tmp/start_daemon.sh

#!/system/bin/sh
/data/local/tmp/nohup 
/data/local/tmp/daemon <portn_number> &