diff --git a/android-offline/HBuilder-Integrate-AS/simpleDemo/libs/Bluetooth-release.aar b/android-offline/HBuilder-Integrate-AS/simpleDemo/libs/Bluetooth-release.aar new file mode 100644 index 0000000..bdbbe05 Binary files /dev/null and b/android-offline/HBuilder-Integrate-AS/simpleDemo/libs/Bluetooth-release.aar differ diff --git a/android-offline/HBuilder-Integrate-AS/simpleDemo/src/main/assets/data/dcloud_properties.xml b/android-offline/HBuilder-Integrate-AS/simpleDemo/src/main/assets/data/dcloud_properties.xml index 1ee1845..51027fc 100644 --- a/android-offline/HBuilder-Integrate-AS/simpleDemo/src/main/assets/data/dcloud_properties.xml +++ b/android-offline/HBuilder-Integrate-AS/simpleDemo/src/main/assets/data/dcloud_properties.xml @@ -1,6 +1,7 @@ + diff --git a/android-offline/README.md b/android-offline/README.md index 1f02001..6c8945b 100644 --- a/android-offline/README.md +++ b/android-offline/README.md @@ -55,6 +55,37 @@ npm run android:pack:raw # 跳过前端编译,仅用现有 dist/build/ap - **appKey 校验**:`appKey` 与 `appId` + 包名 + 证书 SHA-256 严格绑定,不匹配时 APK 能装能开但启动白屏提示「未配置appkey或配置错误」。详见 `config/README.md`。 - **Runtime 版本提示**:`prepare.cjs` 会把 www 内 `manifest.json`/`app-config-service.js` 的 `compilerVersion` 对齐到 `config/android.json` 的 `runtimeVersion`,用于消除启动时「本应用使用 HBuilderX %s 编译,而手机端 SDK 版本是 %s」的提示。 +## 5+ 模块(aar)与 manifest 里勾选的模块 + +离线打包**不会**自动带上 `src/manifest.json` 里勾选的模块,必须同时满足两个条件: + +1. 该模块的 aar 放进 `HBuilder-Integrate-AS/simpleDemo/libs/`; +2. 在 `simpleDemo/src/main/assets/data/dcloud_properties.xml` 里声明对应 ``。 + +否则运行时才报错(例如蓝牙会提示「缺少蓝牙模块」,且代码里找不到该文案——它来自 5+ 运行时)。 + +当前已包含: + +| 模块 | 提供物 | 备注 | +|---|---|---| +| Bluetooth(蓝牙打印 / 蓝牙扫码枪) | `libs/Bluetooth-release.aar` + `` | 从离线 SDK 的 `SDK/libs/` 复制;本工程最初缺这一项(骨架克隆自不使用蓝牙的项目) | +| Barcode / Camera / File / Storage / Console 等 | `libs/lib.5plus.base-release.aar` | 基础运行时自带 | +| Webview-x5 | 未单独引入 | 已比对线上云打包 APK:其原生库与本工程完全一致(无 X5 专属 so),故保持一致 | + +新增其他模块时:到离线 SDK 的 `SDK/libs/` 找同名 aar(命名通常是 `<模块>-release.aar`,如 `geolocation-amap-release.aar`、`share-weixin-release.aar`、`speech-release.aar`),复制到 `libs/`,并在 `dcloud_properties.xml` 增加同名 `` 行——**类名最快来源是从已发布的云端 APK 里抄**: + +```powershell +# 解包云端 APK 后对比两份配置,差异即为缺失的模块声明 +# (线上包 assets/data/dcloud_properties.xml vs 本工程同名文件) +``` + +验证模块是否真的打进包里: + +```powershell +tar -xf release\android\wms-pda_v*.apk -C $env:TEMP\apkchk +findstr /m /c:"io/dcloud/feature/bluetooth" $env:TEMP\apkchk\*.dex +``` + ## 首次使用清单 1. 在 `config/android.json` 填 `appKey`、`keyAlias`、`storePassword`、`keyPassword`(该文件不提交 git);