Panagiotis
Panagiotis

Reputation: 511

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

Upvotes: 1

Views: 1429

Answers (1)

Ankur Aggarwal
Ankur Aggarwal

Reputation: 2220

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"/>

Upvotes: 1

Related Questions