In this lab, you will create a system application with native code support built into AOSP

  1. Create an Android studio project with C++ support
  2. Add class for native methods:

3. Implement the native code and add JNIOnLoad function:

4. Add a simple button and test the native methods

5. Create a directory app in ~/aosp/device/generic/goldfish (here you will store all android applications built into the rom)

Add a generic Android.mk file to call other makefiles in the sub directories:

6. Create the following directory structure in app:

7. Add the following file to the activity_main.xml (res/layout):

and the string table to res/values/strings.xml:

8. Create Android.mk file in the jni directory :

9. Create Android.mk file in jnisamp directory:

10. Add the java and c++ files from your project

11. Add AndroidManifest.xml file to jnisamp directory:

12. build the rom and test your code

Run your application with system privileges

Add coreApp and sharedUserId to the manifest file:

Add the following vars to main Android.mk file:

13. Build the rom and test your work