Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,102 @@

---

## 4:通用方法不生效?通过 ADB 将三件套安装为系统应用

> 适用场景:安卓模拟器、已 root 的设备、或直接安装后 GMS 无法正常初始化的情况。
> 普通 `adb install` 只能装为用户级应用,GMS 必须作为**系统特权应用**放在 `/system/priv-app/` 才能正常工作。

### 前提条件

- 已安装 [ADB 工具](https://developer.android.com/tools/releases/platform-tools)
- 模拟器目录通常有预装Adb.exe,可直接用命令行调用。比如Shift+右键的,在此打开Powershell。
- 设备已开启 USB 调试 / 模拟器已开放 ADB 端口
- 设备已获得 root 权限
- `/system` 分区可写(见下方模拟器专项说明)

### 第一步:确认 ADB 连接

```powershell
# 实体设备通过 USB 连接后执行;模拟器替换为对应端口
adb devices
# 看到设备序列号或 127.0.0.1:端口 即为成功
```

### 第二步:确认系统架构和版本,下载匹配的 APK

```powershell
adb shell getprop ro.build.version.release # 安卓版本,如 12
adb shell getprop ro.build.version.sdk # SDK 版本,如 32
adb shell getprop ro.product.cpu.abi # CPU 架构,如 x86_64 / arm64-v8a
```

前往 [APKMirror](https://www.apkmirror.com) 按照上述信息下载三个 APK,选择规则:
- `minAPI` 不超过你的 SDK 版本 (在Min~Target之间)
- ABI 架构与 `ro.product.cpu.abi` 一致(或选 `nodpi` 通用版)

### 第三步:获取 root 并推送 APK 到 priv-app

```powershell
adb root

# 创建系统特权应用目录
adb shell mkdir -p /system/priv-app/GoogleServicesFramework
adb shell mkdir -p /system/priv-app/GooglePlayServices
adb shell mkdir -p /system/priv-app/Phonesky

# 推送 APK(替换为你本地实际文件路径)
adb push "路径/gsf.apk" /system/priv-app/GoogleServicesFramework/GoogleServicesFramework.apk
adb push "路径/gms.apk" /system/priv-app/GooglePlayServices/GooglePlayServices.apk
adb push "路径/vending.apk" /system/priv-app/Phonesky/Phonesky.apk

# 设置正确权限
adb shell chmod 644 /system/priv-app/GoogleServicesFramework/GoogleServicesFramework.apk
adb shell chmod 644 /system/priv-app/GooglePlayServices/GooglePlayServices.apk
adb shell chmod 644 /system/priv-app/Phonesky/Phonesky.apk

# 重启设备
adb reboot
```

### 第四步:验证安装结果

```powershell
adb shell pm list packages | grep google
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

PowerShell incompatibility: grep not available natively on Windows.

The command uses grep which is not available in Windows PowerShell by default. Since this section explicitly targets PowerShell users (line 103), this command will fail unless users have Git Bash or WSL installed.

🔧 PowerShell-compatible fix
-adb shell pm list packages | grep google
+# PowerShell 用户使用 Select-String:
+adb shell pm list packages | Select-String google
+
+# 或使用 Windows 原生 findstr:
+adb shell pm list packages | findstr google

Alternatively, add a note that grep requires Git Bash/WSL, or use adb shell "pm list packages | grep google" to run grep inside the Android shell instead.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` at line 148, The README contains a PowerShell-incompatible command
"adb shell pm list packages | grep google"; update it to a PowerShell-friendly
alternative or note the requirement: either run grep inside the Android shell by
changing to adb shell "pm list packages | grep google", or provide a native
PowerShell equivalent such as piping to Select-String (adb shell pm list
packages | Select-String google) or using findstr (adb shell pm list packages |
findstr google), and add a short note that grep requires Git Bash/WSL if the
user prefers the original form.

# 应看到:
# package:com.google.android.gsf
# package:com.google.android.gms
# package:com.android.vending
```

三件套出现在列表中,且应用内**没有卸载选项**(只有"停用"),说明已成功安装为系统应用。

---

### 🖥️ MuMu 模拟器 12 专项说明

MuMu Player 12 默认使用**只读系统盘**,需要先切换为可写模式才能操作 `/system`。

**开启可写系统盘:**

在 MuMu 模拟器主界面 → `设置` → `磁盘`(或磁盘相关选项)→ 将系统盘切换为**可写系统盘**,重启模拟器生效。

**验证是否可写:**

```powershell
adb shell "mount | grep system"
# 确认输出包含 (rw,...) 而非 (ro,...)
```

**完成安装后可改回只读:**

GMS 运行只需要 `/data` 分区的读写权限,`/system` 改回只读**不影响已安装的三件套正常使用**,反而能保护系统分区不被意外修改。建议完成安装后切换回只读模式。

> ⚠️ **注意**:MuMu 模拟器**升级**时会用新系统镜像覆盖 `/system`,三件套会丢失。建议升级前备份模拟器实例,或升级后重新执行上述推送步骤(保存好脚本,几分钟即可完成)。

---



> 所有的方法都不行的话还可以尝试备用方案[GBox虚拟空间](https://gboxlab.com) 支持华为鸿蒙系统

#### 替代方案(主流第三方APK商店)
Expand Down