Question

I am going to buy the Nexus 5 when it is available in my country. I then want to make changes (mostly UI) to the Android source code and run it on my phone.

My question is: how do I fastest test the code I have modified? Do I need to compile and create a ROM and flash it after every change to my phone or may I use the emulator and "quick-build" to it?

To clarify: I will download the Android source code and modifiy it. I will change UI stuff so that it suits me. After that I would like to test what I have written, preferably in the device but the emulator is also feasible.

I want to test the Android platform changes. Because I modify the source code I have to create a ROM and flash it to the device as the Android system cannot be installed as an .apk.

What is the fastest way to test the changes? It would be annoying to have to create a ROM and flash it EACH time I make a change to the source code, for instance test that my new UI works accordingly.

Is there some way to do this faster?

Was it helpful?

Solution

It depends at what level you are doing changes. If you are doing frameworks/base/core changes then you can navigate to your frameworks/base/core portion of your AOSP project and do an incremental build by doing (ensure that you initialized your build environment: . build/envsetup.sh in the root of your AOSP source directory):

mm -B

This will build the component you are in, which will be framework's framework.jar/ext.jar/etc

After this compiles then you can do (Be on the lookout for Errors during compilation):

adb root;
adb remount;
adb sync;
adb shell stop;
adb shell start

This will update the framework jar file on the device and then you should be able to see your changes.

Note

This will ONLY work if your current build is the SAME as the AOSP code you are building, otherwise you will have to push the framework.jar file into the system/framework/ portion of your device (which requires root).

OTHER TIPS

I think it's better to recompile the whole source code after the modification.
I suggest to use the AOSP instead of hacking the factory image, no ROM will be needed, just flush with ADB.
The first build will cause a lot of time and space, but the android build system will only build the modified code when rebuilding.
Note: GPS, Sensor are not functional by default, as third part device driver is not included in AOSP.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top