谷歌GMS包添加编译

os:android7.1

 

1、用官方给的包,直接解压在vendor目录下:

  vendor/partner_gms

2、修改device\rockchip\common\BoardConfig.mk

  BUILD_WITH_GOOGLE_MARKET ?= true
  BUILD_WITH_GOOGLE_MARKET_ALL ?= true
  以上两个宏改为true。这两个宏会在device\rockchip\common\device.mk中被调用:
  ifeq ($(strip $(BUILD_WITH_GOOGLE_MARKET)), true)
  ifeq ($(strip $(BUILD_WITH_GOOGLE_MARKET_ALL)), true)
  $(call inherit-product-if-exists, vendor/partner_gms/products/gms.mk)--->这个就是要编译的谷歌服务的makefile。

由于我们实际的包文件命名为google(原先为partner_gms),所以以上路径对应更改为vendor/google/products/gms.mk

gms.mk内容如下:

 1 # GMS mandatory core packages
 2 PRODUCT_PACKAGES += \
 3     AndroidForWork \
 4     ConfigUpdater \
 5     GoogleBackupTransport \
 6     GoogleFeedback \
 7     GoogleLoginService \
 8     GoogleOneTimeInitializer \
 9     GooglePartnerSetup \
10     GoogleServicesFramework \
11     GoogleCalendarSyncAdapter \
12     GoogleContactsSyncAdapter \
13     GoogleTTS \
14     GmsCore \
15     Phonesky \
16 #    SetupWizard
17 
18 # GMS mandatory libraries
19 PRODUCT_PACKAGES += \
20     com.google.android.maps.jar \
21     com.google.android.media.effects.jar
22 
23 # Overlay For GMS devices
24 $(call inherit-product, device/sample/products/location_overlay.mk)
25 PRODUCT_PACKAGE_OVERLAYS += vendor/google/products/gms_overlay
26 
27 # Configuration files for GMS apps
28 PRODUCT_COPY_FILES += \
29     vendor/google/etc/updatecmds/google_generic_update.txt:system/etc/updatecmds/google_generic_update.txt \
30     vendor/google/etc/preferred-apps/google.xml:system/etc/preferred-apps/google.xml \
31     vendor/google/etc/sysconfig/google.xml:system/etc/sysconfig/google.xml
32 
33 # Setting PRODUCT_PREBUILT_WEBVIEWCHROMIUM as yes will prevent from building
34 # webviewchromium from source, and use prebuilt WebViewGoogle.apk in GMS pack
35 PRODUCT_PREBUILT_WEBVIEWCHROMIUM := yes
36 #
37 ifeq ($(PRODUCT_PREBUILT_WEBVIEWCHROMIUM),yes)
38 PRODUCT_PACKAGES += WebViewGoogle
39 # The following framework overlay must be included if prebuilt WebViewGoogle.apk is used
40 PRODUCT_PACKAGE_OVERLAYS += vendor/google/apps/WebViewGoogle/overlay
41 endif
42 
43 # Chrome browser selection
44 # By default, Chrome will be the only preloaded system browser
45 # Use ChromeWithBrowser, if Chrome is preloaded along with another browser side-by-sde
46 PRODUCT_PACKAGES += Chrome
47 #PRODUCT_PACKAGES += ChromeWithBrowser
48 #
49 # Uncomment the following line if customized homepage provider for Chrome should be installed
50 # For the details, see Android.mk in apps/Chrome directory
51 #PRODUCT_PACKAGES += ChromeCustomizations
52 
53 # GMS mandatory application packages
54 #PRODUCT_PACKAGES += \
55 #    Drive \
56 #    Gmail2 \
57 #    Hangouts \
58 #    Maps \
59 #    Music2 \
60 #    Photos \
61 #    Velvet \
62 #    Videos \
63 #    YouTube
64 
65 # GMS optional application packages
66 #PRODUCT_PACKAGES += \
67 #    Books \
68 #    Messenger \
69 #    CalendarGoogle \
70 #    CloudPrint \
71 #    DeskClockGoogle \
72 #    EditorsDocs \
73 #    EditorsSheets \
74 #    EditorsSlides \
75 #    FaceLock \
76 #    Keep \
77 #    LatinImeGoogle \
78 #    Newsstand \
79 #    PlayGames \
80 #    PlusOne \
81 #    TagGoogle \
82 #    talkback
83 
84 # more GMS optional application packages
85 #PRODUCT_PACKAGES += \
86 #    DMAgent \
87 #    GoogleHindiIME \
88 #    GooglePinyinIME \
89 #    NewsWeather \
90 #    JapaneseIME \
91 #    KoreanIME \
92 #    AndroidPay
93 
94 # Overrides
95 PRODUCT_PROPERTY_OVERRIDES += \
96     ro.setupwizard.mode=OPTIONAL \
97     ro.com.google.gmsversion=5.1_r7

 在该.mk中,可以选择屏蔽一些我们不需要的apk,不让其编译。

posted @ 2020-06-09 13:42  M-kobe  阅读(1979)  评论(0编辑  收藏  举报