Skip to content

AndroidPlatformDevelopmentWorkflow

Kees Jongenburger edited this page Mar 27, 2015 · 9 revisions

Android Platform Development Workflow

How to effectively develop when working on the Android platform. If you are using the standard Android SDK you have the
luxury of being able to deploy and debug packages from eclipse. If you are modifying the platform development gets a
litle more difficult. First of all not all the code you will be modifying does not necessarily ends up in a APK package.
Secondly some components that end up in a package still might be using non-official Android APIs.

The naive approach is to run a full make of the whole platform and either create a sdk you can use or a target image
for the device you are using. The approach developers are using is to download a standard SDK stater package and
configure the emulator using environment variable to use the assets created in the android “out” directory.
After checking out the source you need to select the android target you are targeting an setup some path and variables

1) Source build/envsetup.sh
2) Select target (e.g. lunch generic-eng) this also defines ANDROID_PRODUCT_OUT
3) Build using “make”
4) Start the emulator (emulator) possibly with the -partition-size 512 as argument to give it some more root file system storage.

Now to continue development
6) Modify source code
7) Compile the modules you are working on using the “mm” shell function define when doing build/envsetup.sh (use help to get a list of other usefull targets)
8) Run adb sync to sync the out tree and the running targets (you also need to do a adb shell stop ; adb shell start if you are modifying the framework)
9) Run make snod if you want to put your changes in the system image. snod stands for “system image no depedencies”.

Here is a graphical view of the process.
Workflow of Android Platform developmentWorkflow of Android Platform development

If you want to use an editor like eclipse to edit the platform Java code you can try and follow
Using eclipse from the Android site. This is a quite demanding setup
in terms of memory as all the projects and source code of android will be loaded in eclipse. An alternative setup that
works well is create an official android project for your code and add a compile time dependency to the android framework.jar
this can be found after building in out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar.

Sources:
The android platform group topic:How To Make Changes to Android Source (Now With More Questions)
ENEA Android blog blog post:Android Open Source Project workflow.

Other ways to update:
If you have the local sources/build present

run make snod ; adb shell reboot bootloader ; fastboot flashall

If you are working on a remote server
run make updatepackage ; adb shell reboot bootloader ; fastboot update myfile-img.zip

If you are only updating the system
run make otapackage ; adb shell reboot recovery ; (select sideload from adb) and adb sideload mypackage-ota.zip

Clone this wiki locally