问题:鸿蒙OS混合打包后安装失败,提示Error while Deploying HAP(部署HAP时出错)该如何处理?
问题追加: 按照“京东APP鸿蒙版上架实践”文章的步骤进行操作,配置鸿蒙HarmonyOS混合打包,安装时出现如下错误: $ hdc shell bm install -p /sdcard/b8e688e74f47448b824bc151aa688287/ Failure[INSTALL_FAILED_INTERNAL_ERROR] $ hdc shell rm -rf /sdcard/b8e688e74f47448b824bc151aa688287 Error while Deploying HAP 已经反复确认了如下信息: 1、apk打包用的签名和鸿蒙用的签名,密钥和别名都是一样的。 2、包名,版本号,版本名称,配置都是一致的。 通过抓取log发现安装过程有如下报错的日志(其中包名:com.sampson.demo1就是我这边demo的包名): 07-15 16:13:46.877 1564-2491/? W ActivityManager: Invalid packageName: com.sampson.demo1 07-15 16:13:46.878 1096-1132/? W : Failed to SetQosByThread, ret=-1, tid=30260, desired=1 07-15 16:13:46.878 1096-1132/? E AwareLog: iawared: GetFileContent open /proc/30259/task/30261/cpuset fail errno(2)! 07-15 16:13:46.879 1096-1132/? W : Failed to SetQosByThread, ret=-1, tid=30261, desired=1 07-15 16:13:46.960 2428-2808/? W ServiceManager: Permission failure: ohos.permission.INSTALL_BUNDLE from uid=2000 pid=30262 07-15 16:13:46.961 2428-2808/? W ServiceManager: Permission failure: ohos.permission.INSTALL_BUNDLE from uid=2000 pid=30262 07-15 16:13:47.070 4135-4135/? W /system/bin/adbd: type=1400 audit(0.0:10266): avc: denied { search } for pid=4135 comm=73796E6320737663203135 name="oem" dev="dm-7" ino=1368 scontext=u:r:adbd:s0 tcontext=u:object_r:oemfs:s0 tclass=dir permissive=0 07-15 16:13:47.070 4135-4135/? I chatty : uid=2000(shell) /system/bin/adbd identical 1 line 07-15 16:13:47.070 4135-4135/? W /system/bin/adbd: type=1400 audit(0.0:10268): avc: denied { search } for pid=4135 comm=73796E6320737663203135 name="oem" dev="dm-7" ino=1368 scontext=u:r:adbd:s0 tcontext=u:object_r:oemfs:s0 tclass=dir permissive=0 07-15 16:13:47.232 2428-2808/? W ServiceManager: Permission failure: ohos.permission.INSTALL_BUNDLE from uid=2000 pid=30270 07-15 16:13:47.242 2428-2808/? I chatty : uid=1000(system) Thread-459 identical 3 lines 07-15 16:13:47.242 2428-2808/? W ServiceManager: Permission failure: ohos.permission.INSTALL_BUNDLE from uid=2000 pid=30270 07-15 16:13:47.298 1564-2491/? I DeviceIdentifiers: udidHarmony has been read success, return! 07-15 16:13:47.316 1564-2491/? I PackageInstaller: The installerPackageName:android.uid.shell:2000, callingUid:1000 has not INSTALL_PACKAGES permission, so can not set dexOptPolicy. 07-15 16:13:47.317 1564-2491/? I PackageInstaller: createSessionInternal callingPid: 2428, processName: com.huawei.harmonyos.foundation 07-15 16:13:47.336 1564-2491/? I PackageInstallerSession: existingPath:null,isPathExist:false 07-15 16:13:47.344 1564-2491/? I PackageInstallerSession_JNI: TurboZone nativeGetTzFreeBlocks Successful freeblocks 0! 07-15 16:13:47.344 1564-2491/? E TurboZone: TurboZone: No enough space when move apk! 07-15 16:13:47.381 2428-3566/? I PackageParser: packageName: com.sampson.demo1, meta-data has permZA. 07-15 16:13:47.381 2428-3566/? I PackageParser: packageName: com.sampson.demo1, meta-data has isMultiFramework. 07-15 16:13:47.403 1564-2491/? I PackageInstallerSession: isInstallWithHwHepManager isHep:false,isContainHep:false 07-15 16:13:47.427 1564-1733/? I PackageManager: getInstalledApplications cost 2 ms, flags: 8192, userId: 0, callingUid: 1000, callingPid: 1564 07-15 16:13:47.481 1564-2152/? I TrafficMonitor: expired arrive. level:-1 07-15 16:13:47.483 1564-2152/? I TrafficMonitor: update:rxPkts:0,txPkts:0,rxBytes:0,txBytes:0 07-15 16:13:47.484 1564-2152/? I TrafficMonitor: gettimer:interval=5000 07-15 16:13:47.484 1564-2152/? I TrafficMonitor: during_ms:5005,period_ms:2000 07-15 16:13:47.484 1564-2152/? I TrafficMonitor: count:70,rx_sum:0,tx_sum:0,rxBytes:0,during_ms:5005,rx_speed:0.0,tx_speed:0.0,rto:0.0 07-15 16:13:47.484 1564-2152/? I HuaweiWifiWatchdogStateMachine: Get speed information rx_speed = 0 ,tx_speed = 0 ,isSpeedOk = false ,mBestSpeedInPeriod = 22 07-15 16:13:47.505 1564-1733/? I chatty : uid=1000(system) PackageManager identical 8 lines 07-15 16:13:47.505 1564-1733/? I chatty : uid=1000(system) PackageManager identical 1 line 07-15 16:13:47.505 1564-1733/? I chatty : uid=1000(system) PackageManager identical 2 lines 07-15 16:13:47.506 1564-1733/? W SecurityProfileService: verifyPackage must return for huawei policy not found: getPolicy err for SignatureInvalidException, apkPath: /data/app/vmdl241736836.tmp/base.apk 07-15 16:13:47.512 1564-1733/? I PackageParser: packageName: com.sampson.demo1, meta-data has permZA. 07-15 16:13:47.512 1564-1733/? I PackageParser: packageName: com.sampson.demo1, meta-data has isMultiFramework. 07-15 16:13:47.512 1564-1733/? I PackageManager: install from foundation: com.sampson.demo1 07-15 16:13:47.512 1564-1733/? I PackageManager: setSplitPermission pkg: com.sampson.demo1 07-15 16:13:47.512 1564-1733/? E : permissionTranslation_jni: zidanePermissionName is null! 07-15 16:13:47.512 1564-1733/? I chatty : uid=1000(system) PackageManager identical 1 line 07-15 16:13:47.512 1564-1733/? E : permissionTranslation_jni: zidanePermissionName is null! 07-15 16:13:47.512 1564-1733/? W PackageManager: installPackageLI 07-15 16:13:47.527 1564-1733/? I HwPackageManagerServiceUtils: installFailReason is {pkg:null,pkgName:com.sampson.demo1,Ver:1000000,ErrNum:-15,Intaller:android.uid.shell:2000,Msg:installPackageLI} 07-15 16:13:47.527 1564-1733/? I iMonitor: send: 907400000 07-15 16:13:47.527 1564-1733/? I HwFrameworkMonitor: Monitor for 907400000, result=true 07-15 16:13:47.527 1564-1733/? I HwPackageManagerServiceEx: addGrantedInstalledPkg packageName is null 07-15 16:13:47.527 1564-1733/? I HwPackageManagerServiceUtils: sendUpdateBroadCast updatePackageName = com.sampson.demo1, status = 1 , intentPackageName = com.huawei.android.launcher 07-15 16:13:47.528 1564-2070/? I ActivityManager: sendIntentSender target:PendingIntentRecord{34574a5 com.huawei.harmonyos.foundation broadcastIntent}, intent:hwFlg=0x10 07-15 16:13:47.529 1564-2070/? W ActivityManager: Sending non-protected broadcast ohos.bundlemgr.packageinstaller.ACTION_INSTALL_COMMIT.com.sampson.demo1 from system uid 1000 pkg com.huawei.harmonyos.foundation 07-15 16:13:47.529 1564-2070/? W ActivityManager: Sending non-protected broadcast ohos.bundlemgr.packageinstaller.ACTION_INSTALL_COMMIT.com.sampson.demo1 from system uid 1000 pkg com.huawei.harmonyos.foundation
回答: 出现这个问题是因为一开始在Android工程生成的签名文件,没有勾选V1,如下图所示:
所以处理方案很简单,这个V1勾选后就不会出现以上问题了。 相关问题参考:出现com.huawei.signclient.hap.exception.SignatureException。 |