本文列出的GMS Apps安装方式,需要root权限;对于非root手机,可以使用Go安装器/HiGoPlay服务框架安装器(可从 应用宝 下载)安装。
安装步骤如下,
1. 从 The Open GApps Project 下载GMS所用的package。
其中需要选择 Platform、Android版本、GMS package配置(Variant), 根据自己的需要下载至本地;
2. 解压gapps安装包;编写PC端执行脚本,将GMS Core内容push到android机台中。
(注意:GApps默认是在recovery下面执行的,需要先安装第三方的recovery image如CW/TWRP,不过这里我们没有采用这种方式,而是通过PC push)
执行命令如下:./my_install_debug.sh ./open_gapps-arm64-11.0-nano-20220215/
my_install_debug.sh脚本如下(注意:GApps下面的内容没有push):
#!/bin/bash
# sudo apt-get install lzip
c_path=$(dirname "$0")
my_path=$1
core_path=${my_path}Core
gms_path=$c_path/GMS
if [ ! -d $gms_path ] ; then
mkdir $gms_path
fi
for file in ` ls $core_path `
do
echo $file
# 1. unzip *.lz
if [ -f $core_path/$file ] && [ "${file##*.}"x = "lz"x ] ; then
echo $file
lzip -d $core_path/$file
fi
# 2. unzip *.tar
if [ -f $core_path/$file ] && [ "${file##*.}"x = "tar"x ] ; then
echo $file
tar -xvf $core_path/$file -C $core_path
fi
# 3. move files
if [ -d $core_path/$file ] ; then
echo $core_path/$file
find $core_path/$file -name "app" -type d -exec cp -rf {} $gms_path \;
find $core_path/$file -name "priv-app" -type d -exec cp -rf {} $gms_path \;
find $core_path/$file -name "defaultetc-common" -type d -exec cp -rf {} $gms_path \;
find $core_path/$file -name "defaultframework-common" -type d -exec cp -rf {} $gms_path \;
rm -rf $core_path/$file
fi
done
#adb root
adb disable-verity
#adb reboot
#echo "reboot, wait for device online..."
echo "adb root..."
adb root
sleep 1
echo "adb remount..."
adb remount
sleep 5
adb push $gms_path/priv-app /system/
adb push $gms_path/app /system/
#adb push $gms_path/etc /system/
#adb push $gms_path/framework /system/
adb push $gms_path/defaultetc-common/common/etc/default-permissions /system/etc/
adb push $gms_path/defaultetc-common/common/etc/permissions/. /system/etc/permissions/
adb push $gms_path/defaultetc-common/common/etc/preferred-apps/ /system/etc/
adb push $gms_path/defaultetc-common/common/etc/sysconfig/. /system/etc/sysconfig/
adb push $gms_path/defaultframework-common/common/etc/permissions/. /system/etc/permissions/
adb push $gms_path/defaultframework-common/common/framework/. /system/framework/
echo "push done, waiting for reboot..."
adb reboot