Windows 上的安卓应用运行器:双击 APK 即装,应用以独立窗口与桌面图标运行,自持 QEMU 运行时
feat(release): 完整版开箱即用 + 抖音联系入口
RoutineMiku35890aa7b2e5
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex d7fcdb3..7b56b1f 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -40,6 +40,28 @@ jobs:Compress-Archive -Path dist/ApkStart-win64-portable/* -DestinationPath "ApkStart-$tag-win64-portable.zip" -CompressionLevel OptimalGet-Item "ApkStart-$tag-win64-portable.zip" | Select-Object Name, Length+ - name: 组装完整版(内置运行时 + ARM 兼容镜像)+ shell: pwsh+ run: |+ node build/fetch-runtime.js "$PWD/_runtime"+ if ($LASTEXITCODE -ne 0) { exit 1 }+ # 完整版目录结构:ApkStart-win64-portable/ApkStart.exe + runtime/(启动时自动接管)+ New-Item -ItemType Directory -Force -Path full | Out-Null+ Copy-Item -Recurse dist/ApkStart-win64-portable full/ApkStart-win64-portable+ Move-Item _runtime full/ApkStart-win64-portable/runtime+ Get-ChildItem full/ApkStart-win64-portable/runtime | Select-Object Name++ - name: 压缩完整版(分卷,单卷 < 2GB)+ shell: pwsh+ run: |+ $tag = "${{ github.ref_name }}"+ if (-not $tag.StartsWith('v')) { $tag = "v$tag" }+ Push-Location full+ 7z a -t7z -mx=7 -v1900m "..\ApkStart-$tag-win64-full.7z" ApkStart-win64-portable+ if ($LASTEXITCODE -ne 0) { exit 1 }+ Pop-Location+ Get-ChildItem "ApkStart-$tag-win64-full.7z.*" | Select-Object Name, Length+- name: 创建 Releaseenv:GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}@@ -48,4 +70,5 @@ jobs:$tag = "${{ github.ref_name }}"if (-not $tag.StartsWith('v')) { $tag = "v$tag" }$zip = "ApkStart-$tag-win64-portable.zip"- gh release create $tag $zip --title "ApkStart $tag" --generate-notes+ $full = Get-ChildItem "ApkStart-$tag-win64-full.7z.*" | ForEach-Object { $_.FullName }+ gh release create $tag $zip @full --title "ApkStart $tag" --generate-notesdiff --git a/README.md b/README.mdindex ee277bb..eb87d03 100644--- a/README.md+++ b/README.md@@ -34,8 +34,14 @@## 下载即用(不想编译)-到 [Releases](https://github.com/RoutineMiku/apkstart/releases) 下载 `ApkStart-v*-win64-portable.zip`,解压后双击 `ApkStart.exe` 即可。-首次启动进入「运行时」页点**一键部署**,会自动装好 adb / QEMU / 安卓系统镜像,之后长期免装。+到 [Releases](https://github.com/RoutineMiku/apkstart/releases) 下载,两个版本任选:++| 版本 | 文件 | 适合 |+|---|---|---|+| **轻量版** | `ApkStart-v*-win64-portable.zip`(约 100 MB) | 首次启动进入「运行时」页点**一键部署**,自动装好 adb / 引擎 / 系统镜像(官方源 2 分钟内),之后长期免装 |+| **完整版** | `ApkStart-v*-win64-full.7z.001` + `.002`(全部分卷下载后解压 `.001`) | **开箱即用**:已内置运行时引擎、AEHD 驱动与 Android 14 ARM 兼容镜像(翻译层),解压双击 `ApkStart.exe` 直接进主界面,零下载零设置 |++> 完整版用 7-Zip / WinRAR / Bandizip 等解压分卷;两个版本都默认开启 ARM 兼容模式(完整版内置的就是兼容镜像)。## 从源码构建@@ -154,4 +160,4 @@ ApkStart 由 **RoutineMiku** 开发维护。## 许可证-[MIT](LICENSE)。本项目不分发安卓系统镜像、QEMU 二进制或 Google 组件,这些均由用户本机按需下载并遵循各自的许可协议。+[MIT](LICENSE)。轻量版不分发安卓系统镜像、QEMU 二进制或 Google 组件,这些均由用户本机按需下载并遵循各自的许可协议;完整版为便利性将官方公开下载的运行时组件一并打包,相关组件遵循其各自许可协议。diff --git a/build/fetch-runtime.js b/build/fetch-runtime.jsnew file mode 100644index 0000000..212dd7c--- /dev/null+++ b/build/fetch-runtime.js@@ -0,0 +1,47 @@+'use strict';+/**+ * 组装「完整版」内置运行时:+ * node build/fetch-runtime.js <输出目录>+ * 产出 <输出目录>/runtime/:+ * emulator/ + platform-tools/ + aehd/ + system-images/android-34/google_apis_playstore/x86_64/+ * 全部通过 Provisioner 的官方通道下载与校验,与在线版完全同源。+ */+const path = require('path');+const fs = require('fs');++const outRoot = path.resolve(process.argv[2] || '');+if (!outRoot) {+ console.error('usage: node build/fetch-runtime.js <output-runtime-dir>');+ process.exit(1);+}+fs.mkdirSync(outRoot, { recursive: true });++// Provisioner 从 settings.runtime.dir 取根目录:+// 把 APPDATA 指到独立目录,避免污染真实用户配置+process.env.APPDATA = path.join(outRoot, '_appdata');+const store = require('../src/core/store');+store.saveSettings({ runtime: { dir: outRoot } });++const { Provisioner } = require('../src/core/provision');+const prov = new Provisioner(path.resolve(__dirname, '..'));++const log = (p) => console.log(`[${p.stage}] ${p.message} ${p.percent != null ? p.percent + '%' : ''}`);++(async () => {+ await prov.installAehd(log);+ await prov.installAdb(log);+ await prov.installEmulator(log);+ await prov.installPlayImage(log);++ const ok =+ fs.existsSync(path.join(outRoot, 'emulator', 'emulator.exe')) &&+ fs.existsSync(path.join(outRoot, 'platform-tools', 'adb.exe')) &&+ fs.existsSync(path.join(outRoot, 'system-images', 'android-34', 'google_apis_playstore', 'x86_64', 'system.img'));+ if (!ok) throw new Error('运行时组装后校验失败');+ fs.rmSync(path.join(outRoot, '_appdata'), { recursive: true, force: true });+ fs.rmSync(path.join(outRoot, '_tmp'), { recursive: true, force: true });+ console.log('runtime-ready:', outRoot);+})().catch((e) => {+ console.error('fetch-runtime failed:', e.message);+ process.exit(1);+});diff --git a/package.json b/package.jsonindex 399d9bf..ea60dc3 100644--- a/package.json+++ b/package.json@@ -1,7 +1,7 @@{"name": "apkstart","productName": "ApkStart",- "version": "0.2.1",+ "version": "0.2.2","description": "极致轻量的 Windows 安卓应用运行器:双击 APK 即装,应用以独立窗口与桌面图标运行","main": "src/main.js","author": "RoutineMiku",diff --git a/src/core/provision.js b/src/core/provision.jsindex 08a60c6..deef4d7 100644--- a/src/core/provision.js+++ b/src/core/provision.js@@ -247,19 +247,24 @@ class Provisioner {const sysimg = this.systemImageInfo();// 两条路径:emulator(推荐,Google 官方)或 QEMU+ISO(用户自备镜像时)- const emulatorReady = emulator.ok && sysimg.ok;+ // 完整版(内置运行时)只带 ARM 兼容镜像(API 34 Google Play),+ // 开启兼容模式时它就是主镜像,无需再下载 AOSP 默认镜像+ const compatReady = !!(s.runtime && s.runtime.compatImage) && this.playImageInfo().ok;+ const emulatorReady = emulator.ok && (sysimg.ok || compatReady);const qemuReady = qemu.ok && diskSize > MIN_SIZE.disk;return {adb: { ...adb, required: true },emulator: { ...emulator, required: true, note: emulator.ok ? emulator.version : '未安装' },sysimg: {- ok: sysimg.ok,+ ok: sysimg.ok || compatReady,dir: sysimg.dir,- size: sysimg.size,- api: sysimg.api,+ size: sysimg.ok ? sysimg.size : (compatReady ? this.playImageInfo().size : 0),+ api: sysimg.ok ? sysimg.api : (compatReady ? PLAY_SYSIMG.api : sysimg.api),required: false,- note: sysimg.ok ? `Android ${sysimg.api}(${(sysimg.size / 1073741824).toFixed(2)} GB)` : (sysimg.note || '未下载'),+ note: sysimg.ok+ ? `Android ${sysimg.api}(${(sysimg.size / 1073741824).toFixed(2)} GB)`+ : (compatReady ? `Android ${PLAY_SYSIMG.api}(ARM 兼容镜像)` : (sysimg.note || '未下载')),},playImage: this.playImageInfo(),accel,diff --git a/src/main.js b/src/main.jsindex 5d7dc43..8727ae6 100644--- a/src/main.js+++ b/src/main.js@@ -34,6 +34,31 @@ app.commandLine.appendSwitch('disable-features', 'CalculateNativeWinOcclusion');const APP_ROOT = path.join(__dirname, '..');const IS_DEV = process.argv.includes('--dev');++/**+ * 完整版(内置运行时)自动接管:+ * 发行包里 ApkStart.exe 旁边带有 runtime/(emulator + platform-tools + AEHD + ARM 兼容镜像)。+ * 首次启动(settings.json 尚不存在)时直接把 runtime.dir 指向它并开启兼容模式,+ * 用户无需任何下载与设置,开箱即用。之后用户仍可在设置里改回在线版。+ */+function bootstrapBundledRuntime() {+ try {+ const settingsFile = path.join(store.DATA_DIR, 'settings.json');+ if (fs.existsSync(settingsFile)) return; // 只在首次启动时接管+ const exeDir = path.dirname(process.execPath);+ const candidates = [path.join(exeDir, 'runtime'), path.join(path.dirname(exeDir), 'runtime')];+ for (const dir of candidates) {+ const hasEmulator = fs.existsSync(path.join(dir, 'emulator', 'emulator.exe'));+ const hasCompatImg = fs.existsSync(path.join(dir, 'system-images', 'android-34', 'google_apis_playstore', 'x86_64', 'system.img'));+ if (hasEmulator && hasCompatImg) {+ store.saveSettings({ runtime: { dir, compatImage: true } });+ break;+ }+ }+ } catch (_) { /* 接管失败不阻塞启动,走在线引导 */ }+}+bootstrapBundledRuntime();+// 冒烟截图等自动化场景下跳过注册表探测(避免依赖 reg.exe)const NO_SHELL_PROBE = process.argv.includes('--smoke') || process.env.APKSTART_NO_SHELL_PROBE === '1';const ICON_PNG = loadBrandIcon().toPNG();diff --git a/src/ui/assets/douyin-qr.jpg b/src/ui/assets/douyin-qr.jpgnew file mode 100644index 0000000..b57aeb7Binary files /dev/null and b/src/ui/assets/douyin-qr.jpg differdiff --git a/src/ui/index.html b/src/ui/index.htmlindex a2ca410..c20fffa 100644--- a/src/ui/index.html+++ b/src/ui/index.html@@ -267,15 +267,22 @@<div class="about-brand"><img class="about-logo" src="assets/logo.png" alt="ApkStart Logo" draggable="false" /></div>- <div class="about-qr">- <img src="assets/wechat-qr.jpg" alt="微信公众号二维码" width="112" height="112" />- <span class="about-qr-tip">扫码关注公众号</span>+ <div class="about-qrs">+ <div class="about-qr">+ <img src="assets/wechat-qr.jpg" alt="微信公众号二维码" width="112" height="112" />+ <span class="about-qr-tip">扫码关注公众号</span>+ </div>+ <div class="about-qr">+ <img src="assets/douyin-qr.jpg" alt="抖音二维码" width="112" height="112" />+ <span class="about-qr-tip">抖音 · 日常MIKU</span>+ </div></div><div class="about-info"><div class="about-name">ApkStart <span class="about-ver" id="aboutVer"></span></div><p class="note">双击即装的 Windows 安卓应用启动器:APK 安装、桌面快捷方式、独立窗口运行、文件双向互通。</p><div class="about-links"><a href="https://github.com/RoutineMiku/apkstart" target="_blank" rel="noopener">GitHub · RoutineMiku/apkstart</a>+ <a href="https://v.douyin.com/9TIIxVCANig/" target="_blank" rel="noopener">抖音 · @日常MIKU(联系作者)</a><span class="powered">Powered by <b>RoutineMiku</b></span></div></div>diff --git a/src/ui/style.css b/src/ui/style.cssindex cf45cc8..c332ad1 100644--- a/src/ui/style.css+++ b/src/ui/style.css@@ -618,6 +618,11 @@ kbd {box-shadow: 0 2px 10px rgba(15, 23, 32, .18);-webkit-user-drag: none;}+.about-qrs {+ display: flex;+ gap: 14px;+ flex: none;+}.about-qr {display: flex;flex-direction: column;diff --git a/test/engine-test.js b/test/engine-test.jsindex e189eb7..af3c521 100644--- a/test/engine-test.js+++ b/test/engine-test.js@@ -370,6 +370,29 @@ function assert(cond, msg) { if (!cond) throw new Error(msg || '断言失败');assert(!r.ok && r.stage === 'kernel', `应停在 kernel 阶段:${JSON.stringify(r)}`);});+ console.log('\n[provision.js 兼容镜像 / 完整版]');++ await test('playImageInfo 校验 API 34 兼容镜像完整性', async () => {+ const dir = path.join(TMP, 'apkstart', 'runtime', 'system-images', 'android-34', 'google_apis_playstore', 'x86_64');+ fs.mkdirSync(dir, { recursive: true });+ fs.writeFileSync(path.join(dir, 'kernel-ranchu'), 'k');+ const prov = new Provisioner(path.join(__dirname, '..'));+ fs.writeFileSync(path.join(dir, 'system.img'), Buffer.alloc(64));+ assert(!prov.playImageInfo().ok, '过小的镜像不应判定为就绪');+ fs.writeFileSync(path.join(dir, 'system.img'), Buffer.alloc(301 * 1024 * 1024));+ const info = prov.playImageInfo();+ assert(info.ok && info.api === '34' && info.tag === 'google_apis_playstore', `应判定 API 34 兼容镜像就绪:${JSON.stringify(info)}`);+ });++ await test('完整版品牌资产与抖音联系入口就位', async () => {+ const root = path.join(__dirname, '..');+ assert(fs.existsSync(path.join(root, 'src', 'ui', 'assets', 'douyin-qr.jpg')), '缺少抖音二维码图片');+ assert(fs.existsSync(path.join(root, 'build', 'fetch-runtime.js')), '缺少完整版运行时组装脚本');+ const html = fs.readFileSync(path.join(root, 'src', 'ui', 'index.html'), 'utf8');+ assert(html.includes('douyin-qr.jpg'), '关于区未引用抖音二维码');+ assert(html.includes('https://v.douyin.com/9TIIxVCANig/'), '缺少抖音主页链接');+ });+console.log(results.join('\n'));console.log(`\n结果:${passed} 通过,${failed} 失败\n`);try { fs.rmSync(TMP, { recursive: true, force: true }); } catch (_) { /* ignore */ }