Building Apps based on System Apps

683 views
Skip to first unread message

CultOf Droid

unread,
Nov 14, 2011, 9:24:22 PM11/14/11
to Android Building
Dear Droid Cult,

I've built the latest master branch of 2.3.3 on my Ubuntu 11.10, and
in the process, built all the stock apps.

My aim is to:

1> Add custom features to a system app, and make a standalone,
distributable .Apk, with a different app name/credentials/package, so
that it does not try to replace / update the existing system app. In
doing so, I've come across a couple hurdles - some

a> Apps based on system app are built as .apks and .odex files. This
kind of app packaging is NOT distributable, unless you create custom
firmware for the app. I want a regular .apk with classes.dex inside
the Apk. For instance, if I want to make myMail, based on the system
email application, HOW can I make a standalone myMail.apk which is
easily distributable?

b> Clearly building in the OS source path makes the app less portable,
as compared to those built with the standard SDK. Any comments on how
to increase portability, if you base your app on a system app?

Thanks!
CultOf Droid

Magnus Bäck

unread,
Nov 15, 2011, 2:58:55 AM11/15/11
to Android Building
On Tuesday, November 15, 2011 at 03:24 CET,
CultOf Droid <usu.a...@gmail.com> wrote:

[...]

> 1> Add custom features to a system app, and make a standalone,
> distributable .Apk, with a different app name/credentials/package, so
> that it does not try to replace / update the existing system app. In
> doing so, I've come across a couple hurdles - some
>
> a> Apps based on system app are built as .apks and .odex files. This
> kind of app packaging is NOT distributable, unless you create custom
> firmware for the app. I want a regular .apk with classes.dex inside
> the Apk. For instance, if I want to make myMail, based on the system
> email application, HOW can I make a standalone myMail.apk which is
> easily distributable?

Dex pre-optimization (producing the .odex files) is IIRC only performed
when you build PRODUCT-foo-user. If you instead choose the foo-user
configuration with lunch or choosecombo I believe this won't happen.
Alternatively, build with DISABLE_DEXPREOPT=false.

[...]

--
Magnus B�ck Opinions are my own and do not necessarily
SW Configuration Manager represent the ones of my employer, etc.
Sony Ericsson

CultOf Droid

unread,
Nov 15, 2011, 5:02:34 AM11/15/11
to Android Building
Magnus,

Thanks for your reply.

I am a newbie to building Android, and the options for building are
very poorly documented. Would you be kind enough to give me a little
more detail on what files, and what stage of the build process I need
to modify. Do I need to rebuild my entire source tree with new
options?

Again, thanks a ton for your help!

On Nov 14, 11:58 pm, Magnus Bäck <magnus.b...@sonyericsson.com> wrote:
> On Tuesday, November 15, 2011 at 03:24 CET,

Magnus Bäck

unread,
Nov 15, 2011, 3:36:02 PM11/15/11
to Android Building
On Tuesday, November 15, 2011 at 11:02 CET,
CultOf Droid <usu.a...@gmail.com> wrote:

> On Nov 14, 11:58�pm, Magnus B�ck <magnus.b...@sonyericsson.com> wrote:
>
> > Dex pre-optimization (producing the .odex files) is IIRC only
> > performed when you build PRODUCT-foo-user. If you instead choose the
> > foo-user configuration with lunch or choosecombo I believe this
> > won't happen. Alternatively, build with DISABLE_DEXPREOPT=false.
>

> I am a newbie to building Android, and the options for building are
> very poorly documented. Would you be kind enough to give me a little
> more detail on what files, and what stage of the build process I need
> to modify.

The makefile variable DISABLE_DEXPREOPT needs to be set to false. This
can e.g. be done when you call make, like this:

make -j5 DISABLE_DEXPREOPT=false

> Do I need to rebuild my entire source tree with new options?

No, but the apk and jar packaging needs to be redone. The following will
probably do:

rm -rf $OUT/obj/APPS $OUT/obj/JAVA_LIBRARIES $OUT/system/app

Magnus Bäck

unread,
Nov 15, 2011, 3:42:35 PM11/15/11
to Android Building
On Tuesday, November 15, 2011 at 21:36 CET,

Magnus B�ck <magnu...@sonyericsson.com> wrote:

> The makefile variable DISABLE_DEXPREOPT needs to be set to false. This
> can e.g. be done when you call make, like this:
>
> make -j5 DISABLE_DEXPREOPT=false

Gah, should of course be:

make -j5 DISABLE_DEXPREOPT=true

[...]

Reply all
Reply to author
Forward
0 new messages