From 38d246075158b6bc116fa907ee85b71da164d6aa Mon Sep 17 00:00:00 2001 From: lloyd <353627866@qq.com> Date: Sat, 23 Aug 2025 14:54:36 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90Native=E4=BE=A7=E8=B0=83=E7=94=A8HAR/H?= =?UTF-8?q?SP=E6=A8=A1=E5=9D=97=E6=8E=A5=E5=8F=A3=E3=80=91=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 ++-- README_EN.md | 21 +++++++------- build-profile.json5 | 3 +- entry/obfuscation-rules.txt | 0 .../static_module/src/main/cpp/napi_har.h | 29 ------------------- .../static_module/src/main/cpp/napi_har1.h | 23 --------------- entry/src/main/module.json5 | 4 +-- sharedModule/src/main/module.json5 | 4 +-- staticModule/src/main/module.json5 | 4 +-- 9 files changed, 18 insertions(+), 76 deletions(-) create mode 100644 entry/obfuscation-rules.txt delete mode 100644 entry/oh_modules/static_module/src/main/cpp/napi_har.h delete mode 100644 entry/oh_modules/static_module/src/main/cpp/napi_har1.h diff --git a/README.md b/README.md index b681729..65512f1 100644 --- a/README.md +++ b/README.md @@ -86,8 +86,8 @@ 1. 本示例仅支持标准系统上运行,支持设备:华为手机。 -2. HarmonyOS系统:HarmonyOS 5.0.0 Release及以上。 +2. HarmonyOS系统:HarmonyOS 5.0.5 Release及以上。 -3. DevEco Studio版本:DevEco Studio 5.0.0 Release及以上。 +3. DevEco Studio版本:DevEco Studio 5.0.5 Release及以上。 -4. HarmonyOS SDK版本:HarmonyOS 5.0.0 Release SDK及以上。 \ No newline at end of file +4. HarmonyOS SDK版本:HarmonyOS 5.0.5 Release SDK及以上。 \ No newline at end of file diff --git a/README_EN.md b/README_EN.md index 1ba9cb7..e45366e 100644 --- a/README_EN.md +++ b/README_EN.md @@ -55,18 +55,17 @@ Note: When running an app, you need to set **Deploy Multi Hap**. Tap **Edit Conf │ └──Util.ets // ArkTS methods └──sharedModule/src/main // HSP module ├──cpp -│ ├──types // Interfaces exposed by the native layer -│ │ └──libfile_access // Interfaces exposed to the UI layer -│ ├──CMakeLists.txt // Compilation entry -│ ├──napi_hsp.cpp // Native methods provided by the HSP module -│ ├──napi_hsp.h // napi_hsp header file +│ ├──types // Interfaces exposed by the native layer +│ │ └──libfile_access // Interfaces exposed to the UI layer +│ ├──CMakeLists.txt // Compilation entry +│ ├──napi_hsp.cpp // Native methods provided by the HSP module +│ ├──napi_hsp.h // napi_hsp header file │ └──napi_init.cpp -└──ets // UI layer +└──ets // UI layer ├──components │ └──MainPage.ets └──utils -└──Calc.ets // ArkTS methods - +└──Calc.ets // ArkTS methods ``` ### How to Implement * Create **staticModule** (HAR) and **sharedModule** (HSP) and configure the corresponding dependencies in **oh-package.json5** of **entry**. @@ -86,8 +85,8 @@ N/A 1. The sample is only supported on Huawei phones with standard systems. -2. The HarmonyOS version must be HarmonyOS 5.0.0 Release or later. +2. The HarmonyOS version must be HarmonyOS 5.0.5 Release or later. -3. The DevEco Studio version must be DevEco Studio 5.0.0 Release or later. +3. The DevEco Studio version must be DevEco Studio 5.0.5 Release or later. -4. The HarmonyOS SDK version must be HarmonyOS 5.0.0 Release SDK or later. \ No newline at end of file +4. The HarmonyOS SDK version must be HarmonyOS 5.0.5 Release SDK or later. \ No newline at end of file diff --git a/build-profile.json5 b/build-profile.json5 index 57760a7..45721b9 100644 --- a/build-profile.json5 +++ b/build-profile.json5 @@ -6,7 +6,8 @@ { "name": "default", "signingConfig": "default", - "compatibleSdkVersion": "5.0.0(12)", + "compatibleSdkVersion": "5.0.5(17)", + "targetSdkVersion": "5.0.5(17)", "runtimeOS": "HarmonyOS", "buildOption": { "strictMode": { diff --git a/entry/obfuscation-rules.txt b/entry/obfuscation-rules.txt new file mode 100644 index 0000000..e69de29 diff --git a/entry/oh_modules/static_module/src/main/cpp/napi_har.h b/entry/oh_modules/static_module/src/main/cpp/napi_har.h deleted file mode 100644 index a419b42..0000000 --- a/entry/oh_modules/static_module/src/main/cpp/napi_har.h +++ /dev/null @@ -1,29 +0,0 @@ -/* -* Copyright (C) 2024 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -// [Start napi_har_start] -// [Start har_start] -// staticModule\src\main\cpp\napi_har.h -#ifndef CROSSMODULEREFERENCE_NAPI_HAR_H -#define CROSSMODULEREFERENCE_NAPI_HAR_H -#include -// [StartExclude napi_har_start] -napi_env g_main_env; -void setHarEnv(napi_env env); -// [EndExclude napi_har_start] -double harNativeAdd(double a, double b); -napi_value harArkTSAdd(double a, double b); -#endif //CROSSMODULEREFERENCE_NAPI_HAR_H -// [End har_start] -// [End napi_har_start] \ No newline at end of file diff --git a/entry/oh_modules/static_module/src/main/cpp/napi_har1.h b/entry/oh_modules/static_module/src/main/cpp/napi_har1.h deleted file mode 100644 index 8c9cf7a..0000000 --- a/entry/oh_modules/static_module/src/main/cpp/napi_har1.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -* Copyright (C) 2024 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// [Start napi_har_start] -// staticModule\src\main\cpp\napi_har.h -#ifndef CROSSMODULEREFERENCE_NAPI_HAR_H -#define CROSSMODULEREFERENCE_NAPI_HAR_H -#include -double harNativeAdd(double a, double b); -#endif //CROSSMODULEREFERENCE_NAPI_HAR_H -// [End napi_har_start] \ No newline at end of file diff --git a/entry/src/main/module.json5 b/entry/src/main/module.json5 index a1cea8b..ad219d7 100644 --- a/entry/src/main/module.json5 +++ b/entry/src/main/module.json5 @@ -5,9 +5,7 @@ "description": "$string:module_desc", "mainElement": "EntryAbility", "deviceTypes": [ - "phone", - "tablet", - "2in1" + "phone" ], "deliveryWithInstall": true, "installationFree": false, diff --git a/sharedModule/src/main/module.json5 b/sharedModule/src/main/module.json5 index b067847..bbe4e8b 100644 --- a/sharedModule/src/main/module.json5 +++ b/sharedModule/src/main/module.json5 @@ -4,9 +4,7 @@ "type": "shared", "description": "$string:shared_desc", "deviceTypes": [ - "phone", - "tablet", - "2in1" + "phone" ], "deliveryWithInstall": true, "pages": "$profile:main_pages" diff --git a/staticModule/src/main/module.json5 b/staticModule/src/main/module.json5 index affaaba..3ef836a 100644 --- a/staticModule/src/main/module.json5 +++ b/staticModule/src/main/module.json5 @@ -3,9 +3,7 @@ "name": "staticModule", "type": "har", "deviceTypes": [ - "default", - "tablet", - "2in1" + "default" ] } } \ No newline at end of file -- Gitee