Re: [android-building] Building ICS launcher

900 views
Skip to first unread message

Jean-Baptiste Queru

unread,
Nov 30, 2012, 11:00:26 AM11/30/12
to android-...@googlegroups.com
-The latest ICS version is android-4.0.4_r2.1:
https://source.android.com/source/build-numbers.html

-Once you have that, run the following commands:

source build/envsetup.sh
lunch full-eng
make Launcher2
(You can add a -jN parameter to make. I have a beefy workstation and I
use -j32. Even on a lower-end machine, -j4 will most probably help).

-The output should be in
out/target/product/generic/obj/APPS/Launcher2_intermediates/package.apk
(I think).

-Note that Launcher uses private APIs, so there's no guarantee that
the Launcher you build will work on your phone.

JBQ

On Thu, Nov 29, 2012 at 11:51 PM, galapogos <goi...@gmail.com> wrote:
> Hi,
>
> I wish to replace my phone's launcher with ICS's stock launcher. Do I need
> to download the entire 4.0.4 source to build it?
>
> Just in case I do, I'm currently doing this with the following commands:
>
> repo init -u https://android.googlesource.com/platform/manifest
> repo init -u https://android.googlesource.com/platform/manifest -b
> android-4.0.4_r1.1
>
> repo sync -j16
>
> I think android-4.0.4_r1.1 is the latest version?
>
> How do I build the launcher once the source has been downloaded?
>
> Thanks
>
> --
> You received this message because you are subscribed to the "Android
> Building" mailing list.
> To post to this group, send email to android-...@googlegroups.com
> To unsubscribe from this group, send email to
> android-buildi...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-building?hl=en



--
Jean-Baptiste M. "JBQ" Queru
Technical Lead, Android Open Source Project, Google.

Questions sent directly to me that have no reason for being private
will likely get ignored or forwarded to a public forum with no further
warning.

Magnus Bäck

unread,
Dec 3, 2012, 12:30:34 PM12/3/12
to android-...@googlegroups.com
On Monday, December 03, 2012 at 00:02 EST,
galapogos <goi...@gmail.com> wrote:

> Thanks. Are there any changes on the Launcher side between 4.0.4r2.1 and
> 4.0.4r1.1? I've just downloaded the older version and don't wish to
> re-download if there aren't any major changes.

If you synced your workspace after June 6 you already have the
4.0.4_r2.1 code (except any gits that may have been added in that
release).

repo init -b android-4.0.4_r2.1
repo sync

(I don't remember if "repo init" always fetches the latest manifest from
the remote. If not and you have a pre-June 6 workspace you need to run
"repo sync" first to pick up the new manifest.)

> When you say Launcher uses private APIs, what exactly does that mean?
> I will be trying to load it on a Samsung Galaxy S3 international
> running ICS.

Presumably it means that it uses non-public APIs that aren't part of the
SDK.

--
Magnus Bäck
ba...@google.com

Jean-Baptiste Queru

unread,
Dec 5, 2012, 1:19:59 PM12/5/12
to android-...@googlegroups.com
Not without losing the associated functionality.

JBQ

On Tue, Dec 4, 2012 at 11:44 PM, galapogos <goi...@gmail.com> wrote:
> Thanks. Is there any way to remove/disable these private APIs so that that I
> can build a version that works on all Android ICS based phones?
>
> Thanks.

Sihan Goi

unread,
Dec 5, 2012, 7:20:48 PM12/5/12
to android-...@googlegroups.com

Thanks. Is there a list of the private APIs that are used in launcher and what functionality they affect?

Jean-Baptiste Queru

unread,
Dec 5, 2012, 8:48:44 PM12/5/12
to android-...@googlegroups.com
Not off-hand. It should be possible to modify Launcher's Android.mk to
make it build against the SDK, and the build failures should give you
a good idea. I don't remember how to do that.

JBQ

Jean-Baptiste Queru

unread,
Dec 10, 2012, 3:36:23 PM12/10/12
to android-...@googlegroups.com
I'm guessing that you used a user build, where the apks are
pre-optimized for the exact system you built and don't work on
anything else.

Use a userdebug build.

JBQ

On Fri, Dec 7, 2012 at 12:11 AM, galapogos <goi...@gmail.com> wrote:
> OK. Anyway I've just tried to build it as-is, and tried to install it on a
> Galaxy S3 using "adb install". I'm getting a INSTALL_FAILED_DEXOPT
> installation failure. Logcat ouput is as follows:
>
> D/AndroidRuntime( 5431):
> D/AndroidRuntime( 5431): >>>>>> AndroidRuntime START
> com.android.internal.os.RuntimeInit <<<<<<
> D/AndroidRuntime( 5431): CheckJNI is OFF
> D/AndroidRuntime( 5431): setted country_code = France
> D/AndroidRuntime( 5431): setted countryiso_code = FR
> D/AndroidRuntime( 5431): setted sales_code = XEF
> D/AndroidRuntime( 5431): readGMSProperty: start
> D/AndroidRuntime( 5431): readGMSProperty: already setted!!
> D/AndroidRuntime( 5431): readGMSProperty: end
> D/LibQmg_native( 5431): register_android_app_LibQmg
> D/AndroidRuntime( 5431): Calling main entry com.android.commands.pm.Pm
> W/PackageManager( 2093): verifying app can be installed or not
> I/ApplicationPolicy( 2093): isApplicationInstallationEnabled
> D/dalvikvm( 2093): GC_CONCURRENT freed 7885K, 31% free 32346K/46791K, paused
> 2ms+6ms
> D/dalvikvm( 2093): GC_CONCURRENT freed 1834K, 31% free 32555K/46791K, paused
> 3ms+5ms
> E/PackageManager( 2093): Package XXX.XXXXXXX.XXXXXXXX has mismatched uid:
> 10130 on disk, 10131 in settings
> I/PackageManager( 2093): Running dexopt on: XXX.XXXXXXX.XXXXXXXX
> I/PackageManager( 2093): Linking native library dir for
> |XXXX|XXX|XXXXXXXXXXXXXXXXXXXXXX.XXX
> W/dalvikvm( 5442): DexOptZ: zip archive
> '/data/app/com.android.launcher-1.apk' does not include classes.dex
> W/installd( 1907): DexInv: --- END '/data/app/com.android.launcher-1.apk'
> --- status=0xff00, process failed
> E/installd( 1907): dexopt failed on
> '/data/dalvik-cache/data@app@com.android.l...@classes.dex' res =
> 65280
> W/PackageManager( 2093): Package couldn't be installed in
> /data/app/com.android.launcher-1.apk
>
> What could be the problem? In the app's out directory there's an apk file
> and an odex file. Did I install it correctly?
>
> Thanks!

Jean-Baptiste Queru

unread,
Dec 26, 2012, 11:52:55 AM12/26/12
to android-...@googlegroups.com
My best guess is that some of the private APIs used by launcher don't
exist on your phone. If that's the case, when dexopt tries to optimize
launcher for your specific phone, it can't resolve a missing symbol
and fails.

This is why using private APIs in apps that aren't bundled in the
system image is a bad idea.

JBQ

On Tue, Dec 25, 2012 at 10:34 PM, galapogos <goi...@gmail.com> wrote:
> Thanks. I've just tried to build a userdebug build, using the following
> commands:
>
> source build/envsetup.sh
> lunch full-userdebug
> make Launcher2 -j32
>
> I've then tried to install the apk file to my Galaxy S3, but I still get the
> same INSTALL_FAILED_DEXOPT installation error.
>
> Is there something else I'm missing?

Jean-Baptiste Queru

unread,
Dec 28, 2012, 10:37:40 AM12/28/12
to android-...@googlegroups.com
Speaking generally, android-platform is probably a good place to start
the discussion. Once you look at concrete steps (i.e. actual
contributions), android-contrib will be your friend.

Now, specifically about Launcher, there's bad news and there's good news.

The bad news is that Launcher moves very quickly, which means that
it's a tricky target for AOSP contributions: the version in Google's
internal tree is likely to have many changes that don't exist in AOSP
and that will cause conflicts, such that deep contributions in
Launcher could be tricky.

The good news is that from my reading of the Launcher makefile
(packages/apps/Launcher2/Android.mk) it seems that as of 4.2 Launcher
is already only using public APIs: LOCAL_SDK_VERSION := current - that
means that the 4.2 Launcher from AOSP should work unmodified on any
compatible 4.2 device. It doesn't help you for your ICS device, but if
you can mentally fast-forward 2 versions ahead that'll eventually
solve the problem that you're facing.

JBQ

On Thu, Dec 27, 2012 at 5:37 PM, galapogos <goi...@gmail.com> wrote:
> Thanks. Where would be a good place to inquire on possible fixes, e.g.
> removing the private APIs and the features that require these APIs? I'm
> guessing android-building isn't the right place.
>
> Appreciate your help so far.

Jean-Baptiste Queru

unread,
Jan 2, 2013, 1:29:29 PM1/2/13
to android-...@googlegroups.com
You can add LOCAL_SDK_VERSION : = current in the 4.0.4 Android.mk for
Launcher2, and (once you rebuild) that'll cause Launcher2 to get built
against the public API as it existed at the time. It'll fail to build,
which is exactly what you want in this case.

JBQ

On Sun, Dec 30, 2012 at 9:53 PM, galapogos <goi...@gmail.com> wrote:
> Thanks. I've tried android-platform and android-developers before but didn't
> receive as much help as I have here, but I guess I'll try again.
>
> I haven't looked at the 4.2 Launcher yet, but the 4.0.4 Launcher's
> android.mk has no LOCAL_SDK_VERSION field, so I'm not even sure how I'm
> supposed to build it against the public APIs and sort through the error
> messages. Hopefully someone knows and can provide some direction.
>
> Thanks again! You've been very helpful.

Raghav Sood

unread,
Jan 2, 2013, 12:58:35 PM1/2/13
to android-...@googlegroups.com
Hey guys, first post here.

I've tried building the ICS launcher myself a while back (June 2012) and succeeded fairly well.

I open sourced my efforts here:


What doesn't work:

Adding a widget to the homescreen crashes the app as it uses a system level permission. Installing via root into the same place as other system apps may fix this, but I haven't tried.

The app list is strangely magnified. I had this working correctly at some point of time, but then I changed something and it got all zoomed in. Widget list is normal sized though. I don't remember what I changed though, as it was back in June.

If someone is able to fix it, I'd welcome patches and bugfixes. If not, I'll be getting back to it after march, as I have exams right now. Just dropped in to share a mostly working and compiling version.

Thanks


On Mon, Dec 31, 2012 at 11:23 AM, galapogos <goi...@gmail.com> wrote:
Thanks. I've tried android-platform and android-developers before but didn't receive as much help as I have here, but I guess I'll try again.

I haven't looked at the 4.2 Launcher yet, but the 4.0.4 Launcher's android.mk has no LOCAL_SDK_VERSION field, so I'm not even sure how I'm supposed to build it against the public APIs and sort through the error messages. Hopefully someone knows and can provide some direction.

Thanks again! You've been very helpful.


On Friday, December 28, 2012 11:37:40 PM UTC+8, Jean-Baptiste Queru wrote:
>> >> > '/data/dalvik-cache/data@app@com.android.launcher-1.apk@classes.dex'



--
Raghav Sood
http://www.appaholics.in/ - Founder
http://www.apress.com/9781430239451 - Author
+91 81 303 77248

Sihan Goi

unread,
Jan 3, 2013, 9:05:36 PM1/3/13
to android-...@googlegroups.com
Thanks Tim!

Do you have a list of things that you had to change from the AOSP source code to get it to build in Eclipse and install/run correctly on ICS/JB devices?

While I appreciate your source code (I've just tried it and it builds/installs/runs perfectly on my S3 so far), I would like to know what needs to be changed for my own curiosity, I think it'd help me understand the Launcher code better as well, and may help in porting of future versions too.

Thanks!


On Thu, Jan 3, 2013 at 8:11 PM, Tim <tdh...@gmail.com> wrote:
Hey everyone. I ported the ICS (and JB) launcher to an ICS SDK app a while ago. Check it out here:


The Launcher is actually probably the easiest app to convert. Calendar was harder (although hopefully the next AOSP version will basically be "Google Calendar" minus branding), and SMS really hard (and buggy; still haven't fixed MMS). The People app is huge and probably has a ton of private APIs so I haven't bothered.

Anyway, the big thing to change is the widget-adding thing as Raghav noted. In my version you have to choose the widget twice if you aren't running on jellybean.


The other changes are all silly trivial things like changing `mContext` to `getContext()`.

Source for the ICS version here: http://concentriclivers.com/misc/Launcher2.7z  I think anyway. If anyone wants the JB version email me.

Cheers

PS: Interestingly, Google Calendar suffers from some of the same bugs as my ported version. And all this time I thought I'd done something wrong!



--
- Goi Sihan
goi...@gmail.com

Sihan Goi

unread,
Jan 3, 2013, 9:06:05 PM1/3/13
to android-...@googlegroups.com
Thanks Raghav,

Appreciate the input. I'll check your code out!
- Goi Sihan
goi...@gmail.com

Raghav Sood

unread,
Jan 4, 2013, 10:42:02 AM1/4/13
to android-...@googlegroups.com
Here's a list of what all I had to do, that I can recall doing:

There are lots of methods like setFastXXX (for example, setFastAlpha()) that aren't available to us. Changing these to setXXX (for example, setAlpha()) worked for me.

Some thing which are available to us via getSystemService() are initialized directly in the code, like the usage of the Vibrator class. These need to be changed to use getSystemService()

I ended up copying a lot of methods out of the Android source code directly into my classes.

You can checkout a fresh version of the ICS launcher2, and run a diff against the one I opensourced to see the full change list.


On Fri, Jan 4, 2013 at 8:32 PM, Kristjan Laane <kristja...@gmail.com> wrote:
i cannot seem to be able find your email Tim, id be interested in the jb source ? can you send me an email or provide yours? and maybe you can help with the launcher building trouble i have, described at http://stackoverflow.com/questions/14122708/secret-android-build-process 

neljapäev, 3. jaanuar 2013 14:11.40 UTC+2 kirjutas Tim:
Hey everyone. I ported the ICS (and JB) launcher to an ICS SDK app a while ago. Check it out here:


The Launcher is actually probably the easiest app to convert. Calendar was harder (although hopefully the next AOSP version will basically be "Google Calendar" minus branding), and SMS really hard (and buggy; still haven't fixed MMS). The People app is huge and probably has a ton of private APIs so I haven't bothered.

Anyway, the big thing to change is the widget-adding thing as Raghav noted. In my version you have to choose the widget twice if you aren't running on jellybean.


The other changes are all silly trivial things like changing `mContext` to `getContext()`.

Source for the ICS version here: http://concentriclivers.com/misc/Launcher2.7z  I think anyway. If anyone wants the JB version email me.

Cheers

PS: Interestingly, Google Calendar suffers from some of the same bugs as my ported version. And all this time I thought I'd done something wrong!

On Wednesday, 2 January 2013 17:58:35 UTC, Raghav Sood wrote:

Raghav Sood

unread,
Jan 16, 2013, 1:22:52 PM1/16/13
to android-...@googlegroups.com
I've managed to fix the zooming problem. Turns out that if you omit the uses-sdk tag in the manifest, Android launches your app under some sort of compatibility or something. The fixed source code is available in the GitHub repository: https://github.com/RaghavSood/CompilingLauncher2

Raghav Sood
http://www.appaholics.in/ - Founder
http://www.apress.com/9781430239451 - Author
+91 81 303 77248


Reply all
Reply to author
Forward
0 new messages