android 添加 GMS 的编译

一 . 预置gms包

1.将gms包减压到vendor目录下

2.在build/target/product/generic_no_telephony.mk文件中添加以下内容

......

$(call inherit-product, $(SRC_TARGET_DIR)/product/core.mk)

+ $(call inherit-product, vendor/google/products/gms.mk)# 添加这一句

......

3.在build/tools/buildinfo.sh最后加入以下内容,过GMS认证时需将后面的android-google改为公司的client-ID名称

......

+ echo "ro.com.google.clientidbase.am=android-google"

+ echo "ro.com.google.clientidbase.gmm=android-google"

+ echo "ro.com.google.clientidbase.ms=android-google"

+ echo "ro.com.google.clientidbase.yt=android-google"

+ echo "ro.com.google.clientidbase=android-google"

+

echo "# end build properties"

......

4.在vendor/google/products/gms.mk中进行删减要预置的应用

二 、

 GMS\device\*****\*****\device.mk


$(call inherit-product, vendor/partner_gms/products/gms.mk)


三、注意报错

Makefile:1: *** missing separator.  Stop.

一般你多添加了,空格,或者是不正确的 符号


四、报错 2

openwrt编译error: ext4_allocate_best_fit_partial: failed to allocate 13 blocks, out of space?

make menuconfig

找到菜单项"Target Images","Root filesystem partition size (in MB)"

把值改大即可

出现这种情况通常都是修改编译菜单,加了很多东西后,导致编译出来的镜像比较大,如果运行在raspberry,cubieboard一些开发板上,改大无所谓

修改

\master\device\******\*****\BoardConfig.mk


修改system 大小

BOARD_SYSTEMIMAGE_PARTITION_SIZE := 1896873984

#BOARD_SYSBOARD_SYSTEMIMAGE_PARTITION_SIZE := 1896873984

#BOARD_SYSTEMIMAGE_PARTITION_SIZE := 3006477107

TEMIMAGE_PARTITION_SIZE := 3006477107


修改 这个文件

build\core\dex_preopt_odex_install.mk

diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk

old mode 100644

new mode 100755

index 4e486d5..329836c

--- a/core/dex_preopt_odex_install.mk

+++ b/core/dex_preopt_odex_install.mk

@@ -2,44 +2,7 @@

# This file depends on variables set in base_rules.mk

# Output variables: LOCAL_DEX_PREOPT, built_odex, dexpreopt_boot_jar_module

-# Setting LOCAL_DEX_PREOPT based on WITH_DEXPREOPT, LOCAL_DEX_PREOPT, etc

-LOCAL_DEX_PREOPT := $(strip $(LOCAL_DEX_PREOPT))

-ifneq (true,$(WITH_DEXPREOPT))

-  LOCAL_DEX_PREOPT :=

-else # WITH_DEXPREOPT=true

-  ifeq (,$(TARGET_BUILD_APPS)) # TARGET_BUILD_APPS empty

-    ifndef LOCAL_DEX_PREOPT # LOCAL_DEX_PREOPT undefined

-      ifneq ($(filter $(TARGET_OUT)/%,$(my_module_path)),) # Installed to system.img.

-        ifeq (,$(LOCAL_APK_LIBRARIES)) # LOCAL_APK_LIBRARIES empty

-          # If we have product-specific config for this module?

-          ifeq (disable,$(DEXPREOPT.$(TARGET_PRODUCT).$(LOCAL_MODULE).CONFIG))

-            LOCAL_DEX_PREOPT := false

-          else

-            LOCAL_DEX_PREOPT := $(DEX_PREOPT_DEFAULT)

-          endif

-        else # LOCAL_APK_LIBRARIES not empty

-          LOCAL_DEX_PREOPT := nostripping

-        endif # LOCAL_APK_LIBRARIES not empty

-      endif # Installed to system.img.

-    endif # LOCAL_DEX_PREOPT undefined

-  endif # TARGET_BUILD_APPS empty

-endif # WITH_DEXPREOPT=true

-ifeq (false,$(LOCAL_DEX_PREOPT))

-  LOCAL_DEX_PREOPT :=

-endif

-ifdef LOCAL_UNINSTALLABLE_MODULE

-LOCAL_DEX_PREOPT :=

-endif

-ifeq (,$(strip $(built_dex)$(my_prebuilt_src_file))) # contains no java code

-LOCAL_DEX_PREOPT :=

-endif

-# if WITH_DEXPREOPT_BOOT_IMG_ONLY=true and module is not in boot class path skip

-ifeq (true,$(WITH_DEXPREOPT_BOOT_IMG_ONLY))

-ifeq ($(filter $(DEXPREOPT_BOOT_JARS_MODULES),$(LOCAL_MODULE)),)

LOCAL_DEX_PREOPT :=

-endif

-endif

-

built_odex :=

installed_odex :=

built_installed_odex :=


android编译不生成odx文件的方法

从android4.0.3开始,默认编译出来的apk是没发直接安装的,因为其中没有dex文件。4.0.3开始,android默认编译出来的有apk和odex文件,网上有很多把apk和odex集合成可以安装的apk的方法,但是这些方法都比较复杂,其实有一个很简单的方法:

1.对于单个apk:

在该apk的源码的android.mk中增加LOCAL_DEX_PREOPT := false就可以了。

2.对于整个源码:

修改build/core/package.mk和build/core/jave_library.mk(配置编译出来的jar包是),将其中的LOCAL_DEX_PREOPT := true改为LOCAL_DEX_PREOPT := false。

你可能感兴趣的:(android 添加 GMS 的编译)