Skip to content

Windows 上的安卓应用运行器:双击 APK 即装,应用以独立窗口与桌面图标运行,自持 QEMU 运行时

feat(compat): ARM 兼容模式升级 Android 14 —— 字节系应用可运行

RoutineMiku465b9b9ad844
diff --git a/README.md b/README.md
index 1bc1293..ee277bb 100644
--- a/README.md
+++ b/README.md
@@ -131,7 +131,11 @@ Android 版本、freeform 支持、共享目录双向同步,加 `--apk 某应
- **不是从零实现的 hypervisor**:安卓内核、GPU 转译、ART 运行时是数年级别的工程,本项目选择站在 AOSP/QEMU/adb 的肩膀上,把工程量集中在「原生应用级体验」上——这正是应用宝电脑版、Google Play Games PC 版等产品共同的架构思路。
- **共享目录是同步而非挂载**:Windows 无 root 时无法在安卓侧挂载 NTFS 目录,采用秒级双向同步达到同等体验。
-- **ARM-only 应用**:设置里开启「ARM 兼容模式」即可切换到 Google Play 镜像(内置 native bridge 翻译层),普通 ARM-only 应用可以安装运行;但**抖音/红果/番茄等字节系应用无法运行**——它们自带反调试 native hook,会触发 Google 官方翻译层(ndk_translation)的保护性断言(`DoBadTrampoline` SIGABRT),社区换 libhoudini 也存在同类崩溃。这是字节系与官方 x86_64 模拟器的根本冲突,MuMu 能跑是靠私有魔改翻译层。安装失败时 ApkStart 会给出中文说明。
+- **ARM-only 应用 / 字节系应用**:设置里开启「ARM 兼容模式」即可切换到 **Android 14(API 34)Google Play 镜像**(内置新版 ndk_translation 翻译层),仅含 ARM 原生库的应用可以安装运行。**实测红果免费短剧(com.phoenix.read,arm64-v8a-only)可正常安装、进入推荐流并播放视频**——旧版 API 30 镜像上会因字节系自带非标准 signal handler 触发翻译层保护性断言(`DoBadTrampoline` SIGABRT),Android 14 镜像的新版翻译层已修复。个别应用自带更深的反模拟检测(如强制校验真实传感器/基带),仍可能受限;安装失败或启动崩溃时 ApkStart 会给出中文说明。
+
+| 兼容模式下运行红果免费短剧(Android 14 · AEHD 硬件加速) |
+|:---:|
+| ![红果短剧在 ApkStart 兼容模式运行](docs/images/compat-hongguo-playing.png) |
## 关于作者
diff --git a/docs/images/compat-hongguo-playing.png b/docs/images/compat-hongguo-playing.png
new file mode 100644
index 0000000..9fb7b02
Binary files /dev/null and b/docs/images/compat-hongguo-playing.png differ
diff --git a/docs/images/compat-hongguo.png b/docs/images/compat-hongguo.png
new file mode 100644
index 0000000..33773c3
Binary files /dev/null and b/docs/images/compat-hongguo.png differ
diff --git a/package.json b/package.json
index 25715cb..399d9bf 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "apkstart",
"productName": "ApkStart",
- "version": "0.2.0",
+ "version": "0.2.1",
"description": "极致轻量的 Windows 安卓应用运行器:双击 APK 即装,应用以独立窗口与桌面图标运行",
"main": "src/main.js",
"author": "RoutineMiku",
diff --git a/scripts/compat-boot-test.js b/scripts/compat-boot-test.js
new file mode 100644
index 0000000..c0f574e
--- /dev/null
+++ b/scripts/compat-boot-test.js
@@ -0,0 +1,44 @@
+'use strict';
+/* 兼容模式端到端验证:走产品代码路径 boot(API 34 Play 镜像)→ abilist → 装 ARM APK → 启动 */
+process.env.ANDROID_ADB_SERVER_PORT = process.env.ANDROID_ADB_SERVER_PORT || '5038';
+const fs = require('fs');
+const path = require('path');
+const store = require('../src/core/store');
+const { Runtime } = require('../src/core/engine');
+
+const ROOT = path.join(__dirname, '..');
+const APK = process.argv[2] || 'D:\\红果免费短剧.apk';
+
+(async () => {
+ store.saveSettings({ runtime: { compatImage: true } });
+ const rt = new Runtime(ROOT);
+
+ console.log('[1] ensure()(兼容模式 → 应启动 Google Play / API 34 镜像)');
+ const r = await rt.ensure({
+ onLog: (m) => console.log(' [boot]', m),
+ });
+ if (!r.ok) { console.error(' ensure 失败:', r.error || JSON.stringify(r).slice(0, 300)); process.exit(1); }
+ console.log(' engine =', r.engine, r.reused ? '(复用已有实例)' : '');
+
+ const c = rt.client();
+ console.log('[2] release =', await c.shell('getprop ro.build.version.release'));
+ console.log(' sdk =', await c.shell('getprop ro.build.version.sdk'));
+ console.log(' abilist =', await c.shell('getprop ro.product.cpu.abilist'));
+ console.log(' tag =', await c.shell('getprop ro.build.tags'));
+
+ if (APK && fs.existsSync(APK)) {
+ console.log('[3] 安装 ARM APK(红果短剧)…');
+ const ins = await c.install(APK);
+ console.log(' install =', JSON.stringify(ins).slice(0, 160));
+ await c.shell('am start -n com.phoenix.read/com.dragon.read.pages.splash.SplashActivity');
+ await new Promise((res) => setTimeout(res, 20000));
+ const ps = await c.shell('ps -A | grep phoenix');
+ console.log('[4] 启动 20s 后进程:', ps ? '存活 ✓' : '已消失 ✗');
+ } else {
+ console.log('[3] 跳过 APK 安装(未找到', APK, ')');
+ }
+
+ console.log('[5] 恢复普通模式设置');
+ store.saveSettings({ runtime: { compatImage: false } });
+ process.exit(0);
+})().catch((e) => { console.error('FATAL', e); process.exit(1); });
diff --git a/src/core/emulator.js b/src/core/emulator.js
index 6ba3278..56d7c22 100644
--- a/src/core/emulator.js
+++ b/src/core/emulator.js
@@ -54,22 +54,28 @@ class EmulatorEngine {
fs.mkdirSync(avdDir, { recursive: true });
// ARM 兼容模式:使用 Google Play 版镜像(内置 native bridge,可安装仅含 ARM 原生库的应用)
- const compat = !!(s.runtime && s.runtime.compatImage) && this.provisioner.playImageInfo().ok;
+ const playInfo = this.provisioner.playImageInfo();
+ const compat = !!(s.runtime && s.runtime.compatImage) && playInfo.ok;
const tag = compat ? 'google_apis_playstore' : p.sysTag;
const tagDisplay = compat ? 'Google Play (ARM 兼容)' : 'AOSP';
+ const api = compat ? playInfo.api : p.sysApi;
fs.writeFileSync(
path.join(home, `${AVD_NAME}.ini`),
- `avd.ini.encoding=UTF-8\npath=${avdDir.replace(/\\/g, '/')}\ntarget=android-${p.sysApi}\n`,
+ `avd.ini.encoding=UTF-8\npath=${avdDir.replace(/\\/g, '/')}\ntarget=android-${api}\n`,
);
- // 切换镜像 tag(普通 ↔ ARM 兼容)时旧 userdata 不兼容(APEX 模块引导循环),
- // 下次启动带上 -wipe-data 让模拟器重建干净的用户数据
+ // 切换镜像(普通 ↔ ARM 兼容,或镜像 API 版本变化)时旧 userdata 不兼容
+ // (APEX 模块引导循环),下次启动带上 -wipe-data 让模拟器重建干净的用户数据
const cfgPath = path.join(avdDir, 'config.ini');
this.wipePending = false;
if (fs.existsSync(cfgPath)) {
- const prevTag = /tag\.id=(.+)$/m.exec(fs.readFileSync(cfgPath, 'utf8'));
- if (prevTag && prevTag[1].trim() !== tag) {
+ const prev = fs.readFileSync(cfgPath, 'utf8');
+ const prevTag = /tag\.id=(.+)$/m.exec(prev);
+ const prevImg = /image\.sysdir\.1=(.+)$/m.exec(prev);
+ const wantImg = `system-images/android-${api}/${tag}/${p.sysAbi}/`;
+ if ((prevTag && prevTag[1].trim() !== tag)
+ || (prevImg && prevImg[1].trim() !== wantImg)) {
this.wipePending = true;
}
}
@@ -89,7 +95,7 @@ class EmulatorEngine {
`hw.cpu.ncore=${cores}`,
`hw.ramSize=${memoryMB}`,
'vm.heapSize=512',
- `image.sysdir.1=system-images/android-${p.sysApi}/${tag}/${p.sysAbi}/`,
+ `image.sysdir.1=system-images/android-${api}/${tag}/${p.sysAbi}/`,
`tag.id=${tag}`,
`tag.display=${tagDisplay}`,
'disk.dataPartition.size=16G',
diff --git a/src/core/provision.js b/src/core/provision.js
index 4335b50..08a60c6 100644
--- a/src/core/provision.js
+++ b/src/core/provision.js
@@ -34,7 +34,7 @@ const SOURCES = {
sysimgFallback: 'https://dl.google.com/android/repository/sys-img/android/x86_64-30_r11.zip',
// ARM 兼容镜像(Google Play 版,内置 native bridge)
playImgIndex: 'https://dl.google.com/android/repository/sys-img/google_apis_playstore/sys-img2-3.xml',
- playImgFallback: 'https://dl.google.com/android/repository/sys-img/google_apis_playstore/x86_64-30_r09.zip',
+ playImgFallback: 'https://dl.google.com/android/repository/sys-img/google_apis_playstore/x86_64-34_r14.zip',
// Android-x86 9.0-r2(x86_64):仅在用户已自备 ISO 时使用
iso: [
'https://master.dl.sourceforge.net/project/android-x86/Release%209.0/android-x86_64-9.0-r2.iso?viasf=1',
@@ -68,8 +68,10 @@ function absUrl(u, base = REPO_BASE) {
/** 想默认使用的系统镜像(API 级别 + 渠道)。AOSP 版体积小、无 GMS 授权问题。 */
const DEFAULT_SYSIMG = { api: '30', tag: 'default', abi: 'x86_64' };
-// ARM 兼容镜像:Google Play 版自带 native bridge(ARM 翻译层),可安装仅含 ARM 原生库的应用
-const PLAY_SYSIMG = { api: '30', tag: 'google_apis_playstore', abi: 'x86_64' };
+// ARM 兼容镜像:Google Play 版自带 native bridge(ARM 翻译层),可安装仅含 ARM 原生库的应用。
+// 必须 Android 14(API 34):新版 libndk_translation 修复了对字节系 signal trampoline
+// 的误杀(老版本 API 30 镜像上抖音/红果启动即 DoBadTrampoline SIGABRT,实测 API 34 完整可跑)
+const PLAY_SYSIMG = { api: '34', tag: 'google_apis_playstore', abi: 'x86_64' };
const MIN_SIZE = {
adb: 5 * 1024 * 1024,
@@ -624,12 +626,12 @@ class Provisioner {
return this._cache.playUrl;
}
- /** 下载并安装 ARM 兼容镜像(Google Play 版,约 1.3GB) */
+ /** 下载并安装 ARM 兼容镜像(Google Play 版,约 1.5GB) */
async installPlayImage(onProgress = () => {}) {
const p = this.ensureDirs();
const url = await this.resolvePlayUrl();
const zip = path.join(p.tmp, 'play-sysimg.zip');
- onProgress({ stage: 'download', message: '下载 ARM 兼容镜像(约 1.3GB)…', percent: 1 });
+ onProgress({ stage: 'download', message: '下载 ARM 兼容镜像(Android 14,约 1.5GB)…', percent: 1 });
await downloadAnyParallel([url], zip, {
connections: 8,
minChunk: 4 * 1024 * 1024,
@@ -657,6 +659,11 @@ class Provisioner {
const info = this.playImageInfo();
if (!info.ok) throw new Error('兼容镜像解压后校验失败');
+ // 旧版(API 30)兼容镜像不再使用,成功装好后清理腾空间
+ for (const old of ['android-30']) {
+ const legacy = path.join(p.sysImgRoot, old, 'google_apis_playstore');
+ if (fs.existsSync(legacy)) fs.rmSync(legacy, { recursive: true, force: true });
+ }
onProgress({ stage: 'done', message: 'ARM 兼容镜像就绪,重新启动运行时即可生效', percent: 100 });
return info;
}
diff --git a/src/ui/app.js b/src/ui/app.js
index 218bfb9..f97b78d 100644
--- a/src/ui/app.js
+++ b/src/ui/app.js
@@ -664,7 +664,7 @@ function bindSettings() {
const env = ((state.status = await api.runtimeStatus()).env) || {};
const ok = env.playImage && env.playImage.ok;
$('compatInstallField').hidden = !on || !!ok;
- if (on && !ok) toast({ title: 'ARM 兼容模式已开启', body: '还需要下载 Google Play 兼容镜像(约 1.3GB),点击下方按钮开始', type: 'info' });
+ if (on && !ok) toast({ title: 'ARM 兼容模式已开启', body: '还需要下载 Google Play 兼容镜像(Android 14,约 1.5GB),点击下方按钮开始', type: 'info' });
else if (on) toast({ title: 'ARM 兼容模式已开启', body: '重启运行时后生效', type: 'info' });
});
$('setAutoShortcut').addEventListener('change', (e) => save({ createShortcutOnInstall: e.target.checked }));
diff --git a/src/ui/index.html b/src/ui/index.html
index 6d11918..a2ca410 100644
--- a/src/ui/index.html
+++ b/src/ui/index.html
@@ -181,7 +181,7 @@
<div class="field switch-field">
<div>
<label>ARM 兼容模式(Google Play 镜像)</label>
- <span class="sub">改用内置 ARM 翻译层的 Google Play 镜像,可安装仅含 ARM 原生库的应用(约 1.3GB)。注意:抖音/红果等字节系应用因自带反调试 hook,在任何官方模拟器上都无法运行。</span>
+ <span class="sub">改用 Android 14(API 34)Google Play 镜像,内置新版 ARM 翻译层,仅含 ARM 原生库的应用可以安装运行(约 1.5GB)。实测红果免费短剧可正常浏览与播放;个别大厂应用自带深度反模拟检测,仍可能受限。</span>
</div>
<input type="checkbox" id="setCompat" class="switch" />
</div>
diff --git a/test/hongguo-api34-1.png b/test/hongguo-api34-1.png
new file mode 100644
index 0000000..2bcc6f7
Binary files /dev/null and b/test/hongguo-api34-1.png differ
diff --git a/test/hongguo-api34-2.png b/test/hongguo-api34-2.png
new file mode 100644
index 0000000..2bcc6f7
Binary files /dev/null and b/test/hongguo-api34-2.png differ
diff --git a/test/hongguo-api34-3.png b/test/hongguo-api34-3.png
new file mode 100644
index 0000000..f9d2ed7
Binary files /dev/null and b/test/hongguo-api34-3.png differ
diff --git a/test/hongguo-api34-4.png b/test/hongguo-api34-4.png
new file mode 100644
index 0000000..33773c3
Binary files /dev/null and b/test/hongguo-api34-4.png differ
diff --git a/test/hongguo-api34-5.png b/test/hongguo-api34-5.png
new file mode 100644
index 0000000..9fb7b02
Binary files /dev/null and b/test/hongguo-api34-5.png differ