Search code examples
javaandroidmount

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:

mount -o rw,remount /system

My code is:

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

but it doesn't work.

Thanks


Solution

  • 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:

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