作者:徐建祥(netpirate@gmail.com)
日期:2009/12/19
网址:http://www.anymobile.org
移植Google Apps (Market;GTalk;Google Maps;GMail;Voice Search)的大致步骤如下:
1/ 通过ADB,从Google定制的手机下载相关的文件(jar/lib库,apk安装文件,xml权限文件等);
2/ 修改两个make脚本文件:core.mk和generic_with_google.mk;
3/ make generic_with_google,生产新的system.img镜像文件的时候包含这些文件。
注意点:
a. 移植的手机需要支持上网,通过SetupWizard.apk验证Google帐户,该程序在待机界面前运行,验证失败的话,会无法进入待机界面;Market;GTalk;GMail均需要验证Google帐户,Market需要GTalk服务,设置
ro.setupwizard.mode=DISABLED,则开机不会强制验证。
b. Android 1.5版本不支持街景;
c. 如果只移植Google Maps,则只需要移植以下3个文件:
Adding vendor/google/app/Maps.apk
Adding vendor/google/etc/permissions/com.google.android.maps.xml
Adding vendor/google/framework/com.google.android.maps.jar
下面是core.mk和generic_with_google.mk的代码修改:
Sending build/target/product/core.mk
1 PRODUCT_BRAND :=
2 PRODUCT_NAME :=
3 PRODUCT_DEVICE :=
4 PRODUCT_POLICY := android.policy_phone
5 PRODUCT_PROPERTY_OVERRIDES := \
6 ro.config.notification_sound=F1_New_SMS.ogg
7
8 PRODUCT_PACKAGES := \
9 framework-res \
10 Browser \
11 Contacts \
12 Launcher \
13 HTMLViewer \
14 Phone \
15 ContactsProvider \
16 DownloadProvider \
17 GoogleSearch \
18 MediaProvider \
19 SettingsProvider \
20 TelephonyProvider \
21 UserDictionaryProvider \
22 PackageInstaller \
23 Bugreport \
24 ImProvider
Sending build/target/product/generic_with_google.mk
1 # This is a generic product that isn't specialized for a specific device.
2 # It includes the base Android platform including some Google-specific features.
3 # If you do not want to include Google specific features, you should derive
4 # from generic.mk
5 PRODUCT_PROPERTY_OVERRIDES := \
ro.com.google.locationfeatures=1 \
ro.url.legal=http://www.google.com/intl/%s/mobile/android/basic/phone-legal.html \
ro.url.legal.android_privacy=http://www.google.com/intl/%s/mobile/android/basic/privacy.html \
ro.setupwizard.mode=DISABLED
6 PRODUCT_PACKAGES := \
7 GoogleContactsProvider \
8 GoogleSubscribedFeedsProvider
9 # \
10 # com.google.android.gtalkservice \
11 # com.google.android.maps
12 PRODUCT_COPY_FILES := \
13 vendor/google/app/checkin.apk:system/app/checkin.apk \
14 vendor/google/app/Gmail.apk:system/app/Gmail.apk \
15 vendor/google/app/GmailProvider.apk:system/app/GmailProvider.apk \
16 vendor/google/app/GoogleApps.apk:system/app/GoogleApps.apk \
17 vendor/google/app/GooglePartnerSetup.apk:system/app/GooglePartnerSetup.apk \
18 vendor/google/app/GoogleSettingsProvider.apk:system/app/GoogleSettingsProvider.apk \
19 vendor/google/app/gtalkservice.apk:system/app/gtalkservice.apk \
20 vendor/google/app/Maps.apk:system/app/Maps.apk \
21 vendor/google/app/MediaUploader.apk:system/app/MediaUploader.apk \
22 vendor/google/app/NetworkLocation.apk:system/app/NetworkLocation.apk \
23 vendor/google/app/SetupWizard.apk:system/app/SetupWizard.apk \
24 vendor/google/app/Street.apk:system/app/Street.apk \
25 vendor/google/app/Talk.apk:system/app/Talk.apk \
26 vendor/google/app/Vending.apk:system/app/Vending.apk \
27 vendor/google/app/VoiceSearch.apk:system/app/VoiceSearch.apk \
28 vendor/google/etc/permissions/com.google.android.gtalkservice.xml:system/etc/permissions/com.google.android.gtalkservice.xml \
29 vendor/google/etc/permissions/com.google.android.maps.xml:system/etc/permissions/com.google.android.maps.xml \
30 vendor/google/framework/com.google.android.gtalkservice.jar:system/framework/com.google.android.gtalkservice.jar \
31 vendor/google/framework/com.google.android.maps.jar:system/framework/com.google.android.maps.jar \
32 vendor/google/lib/libspeech.so:system/lib/libspeech.so
33
34 $(call inherit-product, $(SRC_TARGET_DIR)/product/generic.mk)
35
36 # Overrides
37 PRODUCT_NAME := generic_with_google
38
注意:
我用的HTC的image提取的google maps 3.0的jar库和apk安装文件,只可以定位成功,无法读取定位后的地图数据,抛出ClassCastException异常:
03-01 16:52:58.561 E/AndroidRuntime( 2453): Uncaught handler: thread main exiting due to uncaught exception
03-01 16:52:58.936 E/AndroidRuntime( 2453): java.lang.ClassCastException: android.graphics.drawable.BitmapDrawable
03-01 16:52:58.936 E/AndroidRuntime( 2453): at com.google.android.maps.MyLocationOverlay.getLocationDot(MyLocationOverlay.java:180)
最后,我是提取的release版的Android 1.5版本的相关文件(Google Add-ons),方法如下:
1)/system/etc/permissions/com.google.android.gtalkservice.xml
2)/system/etc/permissions/com.google.android.maps.xml
3)/system/framework/com.google.android.gtalkservice.jar
4)/system/framework/om.google.android.maps.jar
5)/system/app/Maps.apk (Google Maps v3.1)
参考:
Google Mobile
http://www.google.com/mobile/
HTC Developer Center
http://developer.htc.com/index.html
Building Android 1.5 – Google Apps and audio files
http://www.johandekoning.nl/index.php/2009/07/12/building-android-1-5-google-apps-and-audio-files/
Google Voice Search Wiki
http://en.wikipedia.org/wiki/Google_Voice_Search
Using Google Maps in Android
http://mobiforge.com/developing/story/using-google-maps-android
Android Add-ons(Map API)
http://android.nanshapo.com/topic/view/812.html
posted on 2009-12-19 13:36
Xu Jianxiang 阅读(3017)
评论(0) 编辑 收藏 所属分类:
Android