lazarus鸿蒙开发6:鸿蒙project配置
一、修改project配置
增加应用的支持类型(phone,tablet,2in1)1. 修改模块配置 module.json5
这个文件决定了你的应用允许安装在哪些设备上。
- 打开工程目录:
entry/src/main/module.json5 - 找到
deviceTypes字段 - 将其修改为包含手机、平板和PC(对应为:phone/tablet/2in1):
{ "module": { "name": "entry", "type": "entry", "srcEntry": "./ets/qabilitystage/QAbilityStage.ets", "description": "$string:module_desc", "mainElement": "QAbility", "deviceTypes": [ // When 'phone' is added to the list, the main window does not restore itself to // the desired state after being minimized (QTFOROH-1076). Before it is added // back, be sure that the issue has been resolved. "phone", "tablet", "2in1" ], "deliveryWithInstall": true, "installationFree": false, "pages": "$profile:main_pages", "extensionAbilities": [

2. 修改构建配置 build-profile.json5
这个文件决定了在编译打包时,支持哪些目标设备类型。
- 打开工程根目录和 entry 目录下的
build-profile.json5(两个文件里如果有相关配置都需要改,重点是entry/build-profile.json5) - 找到
targets下的runtimeOS或你自定义的 target 配置 - 将
deviceType修改为支持全平台:
"targets": [ { "name": "default", "runtimeOS": "HarmonyOS", "config": { "deviceType": [ "phone", // 手机 "tablet", // 平板 "2in1" // PC ] } }, { "name": "ohosTest" } ]
注意:修改配置后一定要同步。
二、libs配置
应用程序用到的so文件拷贝到entry-->libs文件夹
ohos_hap_project/ └── entry/ └── libs/ ├── arm64-v8a/ <-- 64位 ARM架构 (对应 aarch64) │ └── libyour_lib.so ├── armeabi-v7a/ <-- 32位 ARM架构 (对应 armv7) │ └── libyour_lib.so └── x86_64/ <-- 64位 x86架构 (对应 PC/模拟器) └── libyour_lib.so
1)拷贝lazarus编译后的so
2)拷贝libLazarusOHOS_Wrapper.so
3)拷贝QT5支持文件
如果应用针对x86_64的,就拷贝到x86_64这个目录,aarch64则拷贝到arm64-v8a


浙公网安备 33010602011771号