问题
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.
回答1:
Use Genymotion as your emulator. It provides root by default.
回答2:
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
来源:https://stackoverflow.com/questions/22277813/developing-a-system-app-using-android-studio-avd-emulator