diff --git a/frameworks/native/appkit/BUILD.gn b/frameworks/native/appkit/BUILD.gn index 26a1bfdfbb266df91b47eee351e5eaac0a4d717a..a3b592856c9098e5911d8a0a4f1bab5a83cd19d1 100644 --- a/frameworks/native/appkit/BUILD.gn +++ b/frameworks/native/appkit/BUILD.gn @@ -210,6 +210,7 @@ ohos_shared_library("appkit_native") { "napi:ace_napi", "preferences:native_preferences", "resource_management:global_resmgr", + "runtime_core:ani_helpers", "safwk:system_ability_fwk", "samgr:samgr_proxy", "storage_service:storage_manager_acl", diff --git a/frameworks/native/appkit/ability_runtime/context/ets_interop_ability_lifecycle_callback.cpp b/frameworks/native/appkit/ability_runtime/context/ets_interop_ability_lifecycle_callback.cpp index 2b2d532b8c75a01c8acbb626e88e375e5ebb0fce..9698b8a82f38420ec1b213c378840792fa6653fd 100644 --- a/frameworks/native/appkit/ability_runtime/context/ets_interop_ability_lifecycle_callback.cpp +++ b/frameworks/native/appkit/ability_runtime/context/ets_interop_ability_lifecycle_callback.cpp @@ -20,6 +20,7 @@ #include "ets_exception_callback.h" #include "ets_runtime.h" #include "hilog_tag_wrapper.h" +#include namespace OHOS { namespace AbilityRuntime { @@ -231,9 +232,12 @@ std::string EtsInteropAbilityLifecycleCallback::GetErrorProperty(ani_error aniEr return propertyValue; } ani_method getterMethod = nullptr; - if ((status = aniEnv->Class_FindGetter(static_cast(errorType), property, &getterMethod)) != ANI_OK || + + if ((status = aniEnv->Class_FindMethod(static_cast(errorType), + arkts::ani_signature::Builder::BuildGetterName(property).c_str(), + nullptr, &getterMethod)) != ANI_OK || getterMethod == nullptr) { - TAG_LOGE(AAFwkTag::APPKIT, "Class_FindGetter failed, status : %{public}d", status); + TAG_LOGE(AAFwkTag::APPKIT, "Class_FindMethod failed, status : %{public}d", status); return propertyValue; } ani_ref aniRef = nullptr;