Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fastest way to test modified Android source code?

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?

like image 798
Simon Zettervall Avatar asked Nov 08 '13 07:11

Simon Zettervall


1 Answers

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).

like image 124
JoxTraex Avatar answered Sep 26 '22 00:09

JoxTraex