参考官方 注册报名https://www.hiascend.com/developer/activities/details/44de441ef599450596131c8cb52f7f8c/signup?channelCode=S1&recommended=496144
hdc是用于Openharmony的命令行调试工具,这边将它与android的adb进行对应
Openharmony | Android |
Ability | Activity |
bundle | packageName |
用中文说的话就是 以前adb 获取的包名,在纯血鸿蒙中就叫bundle ,
android 运行的activity 现在叫 ability
关于 hdc 的服务,在任务管理器中可以看到
hdc进程带有参数 dummy -l 3-s::ffff:127.0.0.1:8710 -m
参数解释
dummy
表示运行 HDC 工具的 dummy 子命令。
dummy 通常用于模拟或测试连接,可能与特定调试场景相关。
-l 3
设置日志等级(Log Level)。
具体级别通常按数字区分:
0: 不输出日志。
1: 输出错误日志。
2: 输出警告和错误日志。
3: 输出详细的调试日志(通常是最详细的)。
-s ::ffff:127.0.0.1:8710
指定连接的目标地址和端口。
::ffff:127.0.0.1 是 IPv4 地址(127.0.0.1)在 IPv6 映射中的表示方式。
127.0.0.1: 指向本地回环地址(localhost)。
8710: 指定的端口号。
该参数通常用于指定设备或服务的连接地址,表示将 HDC 连接到本地设备或服务。
-m
可能是一个标志参数(Flag),通常表示启用特定模式或功能。
具体作用需要查看 hdc.exe 的文档或帮助信息。
常用命令
以微信(com.tencent.wechat)为例
hdc list targets -v
hdc -t deviceIDxxxx shell
1、查看系统安装了哪些应用
hdc shell bm dump -a
2、查询该应用的详细信息
hdc shell bm dump -n com.tencent.wechat -u 100
得到下面一坨东东
com.tencent.wechat:
{
"appId": "com.tencent.wechat_BDzt+HA+eicpXsiMTgQzrRAEE6KUDZUCzKE42ck22zI8VHF5r6G6ZGj8fMCmPOnf/3U5rnRlUcgYKwTA7ZEDnyg=",
"appIdentifier": "5765880207854244859",
"appIndex": 0,
"applicationInfo": {
"GWPAsanEnabled": false,
"accessTokenId": 537063932,
"accessTokenIdEx": 537063932,
"accessible": false,
"allowAppRunWhenDeviceFirstLocked": false,
"allowCommonEvent": [],
"allowEnableNotification": false,
"apiCompatibleVersion": 50001013,
"apiReleaseType": "Release",
"apiTargetVersion": 50001013,
"appDetailAbilityLibraryPath": "",
"appDistributionType": "app_gallery",
"appEnvironments": [
{
"name": "ASAN_OPTIONS",
"value": "detect_stack_use_after_return=true alloc_dealloc_mismatch=0 detect_container_overflow=0"
}
],
"appIndex": 0,
"appPrivilegeLevel": "normal",
"appProvisionType": "release",
"appQuickFix": {
"bundleName": "",
"deployedAppqfInfo": {
"cpuAbi": "",
"hqfInfos": [],
"nativeLibraryPath": "",
"type": 0,
"versionCode": 0,
"versionName": ""
},
"deployingAppqfInfo": {
"cpuAbi": "",
"hqfInfos": [],
"nativeLibraryPath": "",
"type": 0,
"versionCode": 0,
"versionName": ""
},
"versionCode": 0,
"versionName": ""
},
"applicationFlags": 1,
"applicationReservedFlag": 1,
"arkNativeFileAbi": "",
"arkNativeFilePath": "",
"asanEnabled": false,
"asanLogPath": "",
"associatedWakeUp": false,
"bundleName": "com.tencent.wechat",
"bundleType": 0,
"cacheDir": "",
"cloudFileSyncEnabled": false,
"codePath": "/data/app/el1/bundle/public/com.tencent.wechat",
"compileSdkType": "HarmonyOS",
"compileSdkVersion": "5.0.1.112",
"configuration": "",
"cpuAbi": "arm64-v8a",
"crowdtestDeadline": -1,
"dataBaseDir": "/data/app/el2/database/com.tencent.wechat",
"dataDir": "",
"debug": false,
"description": "",
"descriptionId": 0,
"descriptionResource": {
"bundleName": "com.tencent.wechat",
"id": 0,
"moduleName": "entry"
},
"deviceId": "PHONE-001",
"distributedNotificationEnabled": true,
"enabled": true,
"entityType": "unspecified",
"entryDir": "",
"entryModuleName": "",
"fingerprint": "9D4F2B7B0310D637EF99505FAF5FC7C5B8FF16C84B44C4BEABA4F8859BB45912",
"flags": 0,
"formVisibleNotify": false,
"hideDesktopIcon": false,
"hnpPackages": {},
"hwasanEnabled": false,
"icon": "",
"iconId": 788529153,
"iconPath": "$media:app_icon",
"iconResource": {
"bundleName": "com.tencent.wechat",
"id": 788529153,
"moduleName": "entry"
},
"installSource": "com.huawei.hmsapp.appgallery",
"isCompressNativeLibs": true,
"isFreeInstallApp": false,
"isLauncherApp": false,
"isSystemApp": false,
"keepAlive": false,
"label": "$string:app_name",
"labelId": 788529156,
"labelResource": {
"bundleName": "com.tencent.wechat",
"id": 788529156,
"moduleName": "entry"
},
"maxChildProcess": 1,
"metaData": {},
"metadata": {},
"minCompatibleVersionCode": 1049386,
"moduleInfos": [
{
"moduleName": "entry",
"moduleSourceDir": "",
"preloads": []
}
],
"moduleSourceDirs": [],
"multiAppMode": {
"maxCount": 1,
"multiAppModeType": 2
},
"multiProjects": false,
"name": "com.tencent.wechat",
"nativeLibraryPath": "libs/arm64",
"needAppDetail": false,
"organization": "腾讯科技(北京)有限公司",
"overlayState": 0,
"permissions": [],
"process": "com.tencent.wechat",
"removable": true,
"resourcesApply": [],
"runningResourcesApply": false,
"signatureKey": "",
"singleton": false,
"supportedModes": 0,
"targetBundleList": [],
"targetBundleName": "",
"targetPriority": 0,
"tsanEnabled": false,
"ubsanEnabled": false,
"uid": 20020196,
"userDataClearable": true,
"vendor": "Tencent",
"versionCode": 1049386,
"versionName": "1.0.3.42"
},
"compatibleVersion": 50001013,
"cpuAbi": "",
"defPermissions": [],
"description": "",
"entryInstallationFree": false,
"entryModuleName": "entry",
"gid": 20020196,
"hapModuleInfos": [
{
"abilityInfos": [
{
"appIndex": 0,
"applicationName": "com.tencent.wechat",
"backgroundModes": 130,
"bundleName": "com.tencent.wechat",
"codePath": "",
"compileMode": 1,
"configChanges": [],
"continuable": false,
"continueBundleName": [],
"continueType": [
"EntryAbility"
],
"defaultFormHeight": 0,
"defaultFormWidth": 0,
"description": "$string:EntryAbility_desc",
"descriptionId": 788529155,
"deviceCapabilities": [],
"deviceTypes": [
"phone",
"tablet",
"2in1"
],
"enabled": true,
"excludeFromDock": false,
"excludeFromMissions": false,
"extensionAbilityType": 255,
"formEnabled": false,
"formEntity": 0,
"hapPath": "/data/app/el1/bundle/public/com.tencent.wechat/entry.hap",
"iconId": 788529153,
"iconPath": "$media:app_icon",
"isLauncherAbility": false,
"isModuleJson": true,
"isNativeAbility": false,
"isStageBasedModel": true,
"isolationProcess": false,
"kind": "",
"label": "$string:EntryAbility_label",
"labelId": 788529156,
"launchMode": 0,
"maxWindowHeight": 0,
"maxWindowRatio": 0,
"maxWindowWidth": 0,
"metaData": {
"customizeData": []
},
"metadata": [],
"minFormHeight": 0,
"minFormWidth": 0,
"minWindowHeight": 0,
"minWindowRatio": 0,
"minWindowWidth": 0,
"moduleName": "entry",
"name": "EntryAbility",
"orientation": 0,
"orientationId": 0,
"package": "entry",
"permissions": [],
"preferMultiWindowOrientation": "default",
"priority": 0,
"process": "",
"readPermission": "",
"recoverable": false,
"removeMissionAfterTerminate": false,
"resourcePath": "/data/app/el1/bundle/public/com.tencent.wechat/entry/resources.index",
"skills": [
{
"actions": [
"action.system.home",
"action.ohos.push.listener"
],
"domainVerify": false,
"entities": [
"entity.system.home"
],
"permissions": [],
"uris": []
},
{
"actions": [
"action.system.home",
"ohos.want.action.viewData"
],
"domainVerify": false,
"entities": [
"entity.system.home"
],
"permissions": [],
"uris": [
{
"host": "",
"linkFeature": "",
"maxFileSupported": 0,
"path": "",
"pathRegex": "",
"pathStartWith": "",
"port": "",
"scheme": "weixin",
"type": "",
"utd": ""
}
]
},
{
"actions": [
"action.system.home",
"ohos.want.action.viewData"
],
"domainVerify": false,
"entities": [
"entity.system.home"
],
"permissions": [],
"uris": [
{
"host": "wap",
"linkFeature": "",
"maxFileSupported": 0,
"path": "",
"pathRegex": "",
"pathStartWith": "",
"port": "",
"scheme": "weixin",
"type": "",
"utd": ""
},
{
"host": "betalogin",
"linkFeature": "",
"maxFileSupported": 0,
"path": "",
"pathRegex": "",
"pathStartWith": "",
"port": "",
"scheme": "weixin",
"type": "",
"utd": ""
}
]
},
{
"actions": [
"ohos.want.action.sendData"
],
"domainVerify": false,
"entities": [
"entity.system.home"
],
"permissions": [],
"uris": [
{
"host": "",
"linkFeature": "",
"maxFileSupported": 1,
"path": "",
"pathRegex": "",
"pathStartWith": "",
"port": "",
"scheme": "file",
"type": "",
"utd": "general.image"
},
{
"host": "",
"linkFeature": "",
"maxFileSupported": 1,
"path": "",
"pathRegex": "",
"pathStartWith": "",
"port": "",
"scheme": "file",
"type": "",
"utd": "general.video"
}
]
}
],
"srcEntrance": "./ets/entryability/EntryAbility.ets",
"srcLanguage": "js",
"srcPath": "",
"startWindowBackground": "$color:entry_start_window_background",
"startWindowBackgroundId": 788529168,
"startWindowIcon": "$media:start_window_icon",
"startWindowIconId": 788529170,
"supportExtNames": [],
"supportMimeTypes": [],
"supportPipMode": false,
"supportWindowMode": [
0,
1,
2
],
"targetAbility": "",
"theme": "",
"type": 1,
"uid": -1,
"unclearableMission": false,
"uri": "",
"visible": true,
"writePermission": ""
}
],
"aotCompileStatus": 0,
"appEnvironments": [],
"appStartup": "",
"backgroundImg": "",
"buildHash": "",
"bundleName": "com.tencent.wechat",
"colorMode": -1,
"compileMode": 1,
"compressNativeLibs": true,
"cpuAbi": "",
"deliveryWithInstall": true,
"dependencies": [],
"description": "$string:module_desc",
"descriptionId": 788529166,
"deviceTypes": [
"phone",
"tablet",
"2in1"
],
"extensionInfos": [
{
"appIndex": 0,
"bundleName": "com.tencent.wechat",
"compileMode": 1,
"dataGroupIds": [],
"description": "",
"descriptionId": 0,
"enabled": true,
"extensionProcessMode": -1,
"extensionTypeName": "backup",
"hapPath": "/data/app/el1