Gapps 도입 및 빌드

AOSP의 소스를 취득해 빌드한 것에는 Play 스토어 등의 Google 앱이 포함되어 있지 않기 때문에,
무료로 공개된 Gapps를 도입하여 Nexus9(flounder)용 빌드를 시도한다.

・Gapps
ht tp // // 오펜 ps. rg/

・Gapps를 도입한 빌드 방법
htps : // 기주 b. 코 m / 오간 ps / 아오 sp_부이 ld

Gapps 배포 및 빌드 절차(Nexus9용)



소스 획득 및 Gapps 도입



1. Android OS (7.1.2) 빌드 및 Hello World 의 「소스 코드의 다운로드」의 repo init~까지 끝낸다.

2. ${ANDROID_BUILD_TOP}/.repo/manifest/default.xml 끝에 다음을 추가한다.
...
+    <remote name="opengapps" fetch="https://github.com/opengapps/"  />
+
+    <project path="vendor/google/build" name="aosp_build" revision="master" remote="opengapps" />
+    <project path="vendor/opengapps/sources/all" name="all" clone-depth="1" revision="master" remote="opengapps" />
+
+    <!-- arm64 depends on arm -->
+    <project path="vendor/opengapps/sources/arm" name="arm" clone-depth="1" revision="master" remote="opengapps" />
+    <project path="vendor/opengapps/sources/arm64" name="arm64" clone-depth="1" revision="master" remote="opengapps" />
+
+    <project path="vendor/opengapps/sources/x86" name="x86" clone-depth="1" revision="master" remote="opengapps" />
+    <project path="vendor/opengapps/sources/x86_64" name="x86_64" clone-depth="1" revision="master" remote="opengapps" />
</manifest>

3. repo sync로 소스 획득

4. device\htc\flounder\device.mk의 처음에 다음을 추가

device.mk
#
# Copyright (C) 2013 The Android Open-Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

+GAPPS_VARIANT := <variant>
...

variant는 package types 에서 선택.

예:

device.mk
+GAPPS_VARIANT := stock

5. device\htc\flounder\device.mk의 끝에 다음을 추가

device.mk
...
# Add dependency of the proprietary keystore.flounder module.
PRODUCT_PACKAGES += \
    libkeymaster_messages

+$(call inherit-product, vendor/google/build/opengapps-packages.mk)

빌드



6. Android OS (7.1.2) 빌드 및 Hello World 「소스의 빌드」를 실시

오류 1:
...
No private recovery resources for TARGET_DEVICE flounder
build/core/tasks/vendor_module_check.mk:59: *** Error: Product "aosp_flounder" cannot have overlay in vendor tree: vendor/google/build/overlay/pico vendor/google/build/overlay/webview/24 vendor/google/build/overlay/browser vendor/google/build/overlay/dialer vendor/google/build/overlay/mms.
build/core/ninja.mk:163: ターゲット 'out/build-aosp_flounder.ninja' のレシピで失敗しました
make: *** [out/build-aosp_flounder.ninja] エラー 1

[0;31m#### make failed to build some targets (02:19 (mm:ss)) ####[00m

aosp_flounder는 벤더 트리에 ↑ 오버레이가 없다는 오류.
잘 모르기 때문에 vendor\google\build\opengapps-packages.mk의 DEVICE_PACKAGE_OVERLAYS 당
댓글을 달면이 오류가 사라졌습니다.

opengapps-packages.mk
...
-DEVICE_PACKAGE_OVERLAYS += \
-    $(GAPPS_DEVICE_FILES_PATH)/overlay/pico
...
-ifeq ($(GAPPS_FORCE_WEBVIEW_OVERRIDES),true)
-ifneq ($(filter-out $(call get-allowed-api-levels),24),)
-DEVICE_PACKAGE_OVERLAYS += \
-    $(GAPPS_DEVICE_FILES_PATH)/overlay/webview/21
-else
-DEVICE_PACKAGE_OVERLAYS += \
-    $(GAPPS_DEVICE_FILES_PATH)/overlay/webview/24
-endif
PRODUCT_PACKAGES += \
    WebViewGoogle
-endif

-ifeq ($(GAPPS_FORCE_BROWSER_OVERRIDES),true)
-ifneq ($(filter $(call get-allowed-api-levels),23),)
-DEVICE_PACKAGE_OVERLAYS += \
-    $(GAPPS_DEVICE_FILES_PATH)/overlay/browser
-endif
PRODUCT_PACKAGES += \
    Chrome
-endif

-ifneq ($(filter $(call get-allowed-api-levels),23),)
-ifeq ($(GAPPS_FORCE_DIALER_OVERRIDES),true)
-DEVICE_PACKAGE_OVERLAYS += \
-    $(GAPPS_DEVICE_FILES_PATH)/overlay/dialer

PRODUCT_PACKAGES += \
    GoogleDialer
-endif
-endif

-ifeq ($(GAPPS_FORCE_MMS_OVERRIDES),true)
-DEVICE_PACKAGE_OVERLAYS += \
-   $(GAPPS_DEVICE_FILES_PATH)/overlay/mms

PRODUCT_PACKAGES += \
    PrebuiltBugle
-endif

ifeq ($(GAPPS_FORCE_PIXEL_LAUNCHER),true)
GAPPS_EXCLUDED_PACKAGES += \
    GoogleHome

-ifneq ($(filter $(call get-allowed-api-levels),25),)
-DEVICE_PACKAGE_OVERLAYS += \
-    $(GAPPS_DEVICE_FILES_PATH)/overlay/pixelicons

PRODUCT_PACKAGES += \
    PixelLauncherIcons
-endif

에러 2:
...
No private recovery resources for TARGET_DEVICE flounder
build/core/tasks/vendor_module_check.mk:64: *** Error: vendor PRODUCT_COPY_FILES file "vendor/opengapps/sources/all/etc/sysconfig/google.xml:system/etc/sysconfig/google.xml" has unknown owner.
build/core/ninja.mk:163: ターゲット 'out/build-aosp_flounder.ninja' のレシピで失敗しました
make: *** [out/build-aosp_flounder.ninja] エラー 1

[0;31m#### make failed to build some targets (40 seconds) ####[00m

htps : // 기주 b. 코 m / 오펜 가 ps / 아오 sp_부이 ld / 이스에 s / 23
h tps : // s t c ゔ ぇ rf ぉ w. 코 m / 쿠에 s 치온 s / 17333191 / 부이 l ぢ g ゜ ゔ
↑ 기재의 PRODUCT_RESTRICT_VENDOR_FILES를 false로 하는 방법으로 빌드는 통과하게 되었다.

device\htc\flounder\aosp_flounder.mk

aosp_flounder.mk
...
PRODUCT_NAME := aosp_flounder
PRODUCT_DEVICE := flounder
PRODUCT_BRAND := Android
PRODUCT_MODEL := AOSP on Flounder
PRODUCT_MANUFACTURER := HTC
-PRODUCT_RESTRICT_VENDOR_FILES := owner path
+PRODUCT_RESTRICT_VENDOR_FILES := false
...
[0;32m#### make completed successfully (02:44:51 (hh:mm:ss)) ####[00m

Gapps가 들어간 빌드에서는 system.img가 1GB 정도 커졌다.

Nexus9에 쓰기


$ adb reboot bootloader
$ fastboot flash boot <ビルドしたboot.imgのあるフォルダパス>/boot.img
$ fastboot flash system <ビルドしたsystem.imgのあるフォルダパス>/system.img
$ fastboot reboot

그 후 초기화를 행한다.

Gapps 도입 전






Gapps 도입 후







Google 앱이 설치되어 있는지 확인했습니다.

좋은 웹페이지 즐겨찾기