7

I'm developing an app that requires the android.permission.DUMP permission. This is only permitted for "system" apps (apps signed by the device vendor), or, I'm assuming, apps with root permissions.

How does one develop (and test) an app like that using the AVD emulators? I declare the permission I need, and then build and run the app in the emulator, but when I get to the portion that runs, I run into the same permission error whether I specify the permission in the manifest or not.

How does one develop these types of apps?

I realize that if this was a real device, I would need to root it and/or install a custom ROM. But surely there's a way to tell the emulator to treat my app as if it already was. I keep looking for an "install app as system app" or "run as root" checkbox in the IDE, and I can't find one.

Paschalis
  • 11,929
  • 9
  • 52
  • 82
clemej
  • 2,553
  • 2
  • 19
  • 28
  • 1
    System apps need to be preinstalled. You'd need to build a custom ROM, or be preinstalled by the OEM. Note that it will not be able to ever work over Google Play or other store. You may be able to get it to work if you just have root and install the apk manually in the system apps folder. – Gabe Sechan Mar 09 '14 at 02:53
  • yeah!!! you need to root your device to develop and install system app. – Pankaj Mar 09 '14 at 02:57
  • 4
    So how to "vendors" create these apps, by building their own custom AVD images from their own custom installs? And every time they want to test the app, they re-build their roms? Surely there must be a way to override the setting on the default ROMs that come with the android studio SDK? I keep looking for a "install this app as system app" checkbox in the IDE... – clemej Mar 09 '14 at 03:00
  • As the adb shell and push commands already run as root on the emulator, you can try the hack people sometimes do on modified devices, of remounting the system partition as writable and copying the apk there beside the others, but no guarantees as that's not an intended capability. – Chris Stratton Mar 09 '14 at 04:18
  • All emulators provide root by default, but you still need to request root permission in your app, and you as a user must grant it before your app really gets root. The same goes with an actual real rooted device – Stephan Branczyk Jul 28 '15 at 04:15

2 Answers2

2

Use Genymotion as your emulator. It provides root by default.

free3dom
  • 18,729
  • 7
  • 52
  • 51
0

The normal workflow is build the app as a plain java app project just as you were contributing to the min android OS and create a custom OS image and than execute the emulator using that image and of course you are adjusting that android OS to install as preinstalled your systems app

Fred Grott
  • 3,505
  • 1
  • 23
  • 18