简体   繁体   English

通过应用程序在Android设备中执行安装命令

[英]Executing mount command in Android device via application

I have already rooted my emulator android device and now want to execute the following system call: 我已经植根了模拟器android设备,现在想执行以下系统调用:

mount -o rw,remount /system 挂载-o rw,重新挂载/ system

My code is: 我的代码是:

Runtime.getRuntime().exec( "su -c mount -o rw,remount /system" );

but it doesn't work. 但这不起作用。

Thanks 谢谢

Try this: 尝试这个:

Runtime.getRuntime().exec( new String[]{"su", "-c", "mount -o remount,rw /system"} );

Try this as well: 也尝试一下:

Runtime.getRuntime().exec( new String[]{"su", "-c", "mount -o remount rw /system"} );

Also, you need the following permission in your Android Manifest: 另外,您需要在Android清单中具有以下权限:

<uses-permission android:name="android.permission.ACCESS_SUPERUSER"/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM