Recompile and overwrite applications in system/app

Search This thread

UndeadCretin

Senior Member
Jan 13, 2009
88
216
Kent
As an experiment I am trying to rebuild some standard android applications and replace them in system/app on the G1. I have been through all the steps to get the source code and build for the dream platform and have built the various .apk files of interest (e.g. AlarmClock.apk, Browser.apk etc)

To put the files on the device I delete the old .apk and .odex files and copy my newly built .apk file on to the device. However when I try to run the application it crashes with the following message.

The application Alarm Clock (process com.android.alarmclock) has stopped unexpectedly. Please try again.

I know that replacing the applications like this is possible, because the AutoRotating Browser build works fine when copies over in this manner.

I'm using JF1.31 (RC8)

My initial reaction was that I was not signing the applications properly but having read some posts I think the default built .apk should have the right key already in it.

Another theory I have is that perhaps the applications from the head of the source tree are not compatible with the RC8 (or RC30) Android OS releases. Can anyone tell me how to get the source tree which corresponds to this baseline, I've done some reading around but cannot figure it out. I presume I need to do a repo init -u git://android.git.kernel.org/platofrm/manifest.git -b BASELINE but I can't figure out what BASELINE should be.

Many thanks in advance for any help you can give me!!!
 
  • Like
Reactions: dtr145r

worry

Senior Member
Nov 26, 2008
164
6
Seattle
There are some branches in android sources:
master
cupcake
release-1.0

Apps from the first two will not run on default G1, you need to reinstall a whole system. I think by default, following google docs you'll get master. So you need to download a release-1.0 sources.

I may be wrong, but that is what I'm see from my experience.
 
Last edited:

MasterBunnyFu

Senior Member
Dec 11, 2008
50
0
I was also trying to recompile some of the built-in apps, specifically the browser, but I can't even get it to build. I get a bunch of import errors, stating that it can't find some of the android libraries, such as android.net.http.AndroidHttpClient, android.os.AsyncTask, etc. I've got the android.jar from the SDK in my build path, and it finds some of them, such as android.webkit.URLUtil.

Can anyone shed some light on what I need to do to get it to see the missing libraries? Thanks.
 

Koush

Retired Recognized Developer
Sep 21, 2007
917
872
Thanks for that, I'll get the 1.0 branch downloaded and have a go with that.

Cheers for your help!

There are around a dozen build breaks in release-1.0... all of them are due to missing header #includes in various .c and .h files. So, when it doesn't work, don't give up. Fix the breaks and everything will build properly.
 

Phromik

Senior Member
Nov 11, 2008
156
474
Are you resigning the .apk files? Cuz you have to do that for them to work correctly.
 

UndeadCretin

Senior Member
Jan 13, 2009
88
216
Kent
There are around a dozen build breaks in release-1.0... all of them are due to missing header #includes in various .c and .h files. So, when it doesn't work, don't give up. Fix the breaks and everything will build properly.

Yep I fixed these problems but I have now hit upon the following problem:

(unknown): error 17: Field android.hardware.SensorManager.LIGHT_NO_MOON has changed value from 0.0010f to 0.001f

******************************
You have tried to change the API from what has been previously released in
an SDK. Please fix the errors listed above.
******************************

I've been in and modified SensorManager back to 0.0010f and that let me build get further but I hit the same error again later in the build.

Given that release-1.0 should be a stable branch is it normal to get all these build issues?
 

UndeadCretin

Senior Member
Jan 13, 2009
88
216
Kent
Managed to fix the java issue by modifying public_api.xml. Then hit several more C++ problems which I fixed and finally I can build the lot!

Just tried building the AlarmClock application and running on the G1 and it works fine. Thanks everyone for your help!
 

worry

Senior Member
Nov 26, 2008
164
6
Seattle
>Managed to fix the java issue by modifying public_api.xml. Then hit several more C++ problems which I fixed and finally I can build the lot!

Can you write, what did you fix?
 

ximonx

Senior Member
Jan 4, 2009
55
20
^ Agreed, let us know which files need modifying and what needs doing, i've been trying to get my release-1.0 build root working too!

Alternatively, UndeadCretin, could you build the firmware (release-1.0) with a modified framework-res i can send you?
 
Last edited:

worry

Senior Member
Nov 26, 2008
164
6
Seattle
Ok, I managed to compile it without any editing of xml.
Just added stdlib, string, vector headers to dozen of cpp/h.
 

UndeadCretin

Senior Member
Jan 13, 2009
88
216
Kent
>Managed to fix the java issue by modifying public_api.xml. Then hit several more C++ problems which I fixed and finally I can build the lot!

Can you write, what did you fix?

To fix the java issue, I modified frameworks/base/core/java/android/hardware/SensorManager to change the LIGHT_NO_MOON value to 0.0010f (from 0.001f) and in out/target/common/obj/PACKAGING I modified the <field name="LIGHT_NO_MOON" to have value-"0.0010f">

After this there were several other c++ files which were missing relevant includes. I'm afraid I didn't keep a note of these so cannot provide much detail but mostly they were missing one of the following

#include "stdlib.h"
#include "string.h"
#include "stdio.h"

I think one file needed the following include

#include <string>

and there were a couple of other files that needed other includes. The best way to find these is to google for the function name that isn't building and you should be able to find the appropriate include (that's how I did it).

Hope that helps a bit!
 

UndeadCretin

Senior Member
Jan 13, 2009
88
216
Kent
were you able to repo sync after adding the local_manifest.xml?

I did try that previously but it didn't work. I don't think the relevant files for the dream build are available in the release-1.0 branch. This wasn't a problem for me since I'm only interested in building the applications which work fine with the generic build.
 

Phlogiston

Senior Member
Nov 5, 2008
110
0
I would like to do the same for the mms application. Could you give me the steps or a link how to do it? I mean do I need the whole sources from android platform to do it? How can I just compile one application?
 

UndeadCretin

Senior Member
Jan 13, 2009
88
216
Kent
I would like to do the same for the mms application. Could you give me the steps or a link how to do it? I mean do I need the whole sources from android platform to do it? How can I just compile one application?

I downloaded the whole Android source (the release-1.0 branch) and compiled the lot. It may be possible to just build the individual application but I do not know how. It is not vital to build for the dream platform if you only care about the applications since they will work fine with the generic build.

So the basic steps to start are:

Get yourself a Linux or Mac OS platform (I use Ubuntu running in VMWare on my XP box).

Follow the instructions here: http://source.android.com/download but when you come to repo init add the flag -b release-1.0

Fix various build problems
 

ximonx

Senior Member
Jan 4, 2009
55
20
When recompiling individual apps to replace system apps is there a way of just building a single application or does the entire thing need making?
 

derfolo

Senior Member
Jan 15, 2009
184
1
When recompiling individual apps to replace system apps is there a way of just building a single application or does the entire thing need making?

My experience is that you have to do the whole thing if you are building from source. There is one way I know of to get around this, which is to use baksmali and smali.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    As an experiment I am trying to rebuild some standard android applications and replace them in system/app on the G1. I have been through all the steps to get the source code and build for the dream platform and have built the various .apk files of interest (e.g. AlarmClock.apk, Browser.apk etc)

    To put the files on the device I delete the old .apk and .odex files and copy my newly built .apk file on to the device. However when I try to run the application it crashes with the following message.

    The application Alarm Clock (process com.android.alarmclock) has stopped unexpectedly. Please try again.

    I know that replacing the applications like this is possible, because the AutoRotating Browser build works fine when copies over in this manner.

    I'm using JF1.31 (RC8)

    My initial reaction was that I was not signing the applications properly but having read some posts I think the default built .apk should have the right key already in it.

    Another theory I have is that perhaps the applications from the head of the source tree are not compatible with the RC8 (or RC30) Android OS releases. Can anyone tell me how to get the source tree which corresponds to this baseline, I've done some reading around but cannot figure it out. I presume I need to do a repo init -u git://android.git.kernel.org/platofrm/manifest.git -b BASELINE but I can't figure out what BASELINE should be.

    Many thanks in advance for any help you can give me!!!