From 807b5455069344057556588561baf96a9d5e49ae Mon Sep 17 00:00:00 2001 From: liufumingren Date: Fri, 2 Oct 2026 21:36:23 +0800 Subject: [PATCH] =?UTF-8?q?fix(apk):=20=E6=B8=85=E7=90=86=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E7=9A=84=20BootReceiver=20=E6=BA=90=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=B9=B6=E4=BF=AE=E6=AD=A3=20keystore=20=E5=88=AB=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 删除 com/gztbyc/sandan/BootReceiver.java(重复类导致 javac 报错) - 别名修正为 __uni__0b3dad3(DCloud 规则:__uni__ + appid 小写) - config/README 与 example 补充别名规则说明 --- .../java/com/gztbyc/sandan/BootReceiver.java | 34 ------------------- config/README.md | 2 +- config/android.example.json | 2 +- 3 files changed, 2 insertions(+), 36 deletions(-) delete mode 100644 android-offline/HBuilder-Integrate-AS/simpleDemo/src/main/java/com/gztbyc/sandan/BootReceiver.java diff --git a/android-offline/HBuilder-Integrate-AS/simpleDemo/src/main/java/com/gztbyc/sandan/BootReceiver.java b/android-offline/HBuilder-Integrate-AS/simpleDemo/src/main/java/com/gztbyc/sandan/BootReceiver.java deleted file mode 100644 index 5083d74..0000000 --- a/android-offline/HBuilder-Integrate-AS/simpleDemo/src/main/java/com/gztbyc/sandan/BootReceiver.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.gztbyc.pda_wms; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; - -/** - * 开机自启:监听系统开机完成广播,自动拉起应用。 - * 说明:Android 3.1+ 要求应用至少被用户启动过一次后,BOOT_COMPLETED 才会送达。 - */ -public class BootReceiver extends BroadcastReceiver { - - private static final String ACTION_QUICKBOOT_POWERON = "android.intent.action.QUICKBOOT_POWERON"; - - @Override - public void onReceive(Context context, Intent intent) { - if (intent == null || intent.getAction() == null) { - return; - } - final String action = intent.getAction(); - if (!Intent.ACTION_BOOT_COMPLETED.equals(action) && !ACTION_QUICKBOOT_POWERON.equals(action)) { - return; - } - try { - Intent launch = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName()); - if (launch != null) { - launch.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); - context.startActivity(launch); - } - } catch (Exception e) { - // 启动失败不阻断系统广播 - } - } -} diff --git a/config/README.md b/config/README.md index 5fc9ce5..cb2f35f 100644 --- a/config/README.md +++ b/config/README.md @@ -20,7 +20,7 @@ | `wwwSource` | App 资源目录。留空则依次尝试 `unpackage/resources//www`、`dist/build/app-plus` | | `runtimeVersion` | 离线 SDK 的 5+ Runtime 版本。`prepare.cjs` 会把 www 内 `manifest.json`/`app-config-service.js` 的 `compilerVersion` 对齐到该值,避免启动时弹「HBuilderX %s 编译 / 手机端 SDK %s」提示 | | `signing.keystore` | 签名文件路径(相对项目根),放在 `android-offline/keystore/`(该目录 git 不跟踪) | -| `signing.storePassword` / `keyAlias` / `keyPassword` | 签名密码与别名,**自己填写,不要提交** | +| `signing.storePassword` / `keyAlias` / `keyPassword` | 签名密码与别名,**自己填写,不要提交**。DCloud 下发的 keystore(PKCS12)别名固定为 `__uni__` + appid 小写,本项目即 `__uni__0b3dad3`;PKCS12 的 `storePassword` 与 `keyPassword` 必须相同 | ## appKey 务必与三者一致 diff --git a/config/android.example.json b/config/android.example.json index 60e15c1..f4d87dd 100644 --- a/config/android.example.json +++ b/config/android.example.json @@ -11,7 +11,7 @@ "signing": { "keystore": "android-offline/keystore/xxx.keystore", "storePassword": "", - "keyAlias": "", + "keyAlias": "__uni__0b3dad3", "keyPassword": "" } }