HarmonyOS context getApplicationContext偶现崩溃
在AbilityStage获取context。
BasicConfig.getInstance().setAppContext(this.context.getApplicationContext())
const context = BasicConfig.getInstance().getAppContext()
if (context) {
AuthCenter.initUdb(context.getApplicationContext(), new LoginAuthHandler())
}
崩溃日志:
#00 pc 0000000000474d94 /system/lib64/platformsdk/libark_jsruntime.so(panda::ecmascript::NonMovableMarker::HandleRangeRoots(unsigned int, panda::ecmascript::Root, panda::ecmascript::ObjectSlot, panda::ecmascript::ObjectSlot)+260)(95b2781bd3970de0ded17d64930b4bc8)
#01 pc 0000000000309770 /system/lib64/platformsdk/libark_jsruntime.so(95b2781bd3970de0ded17d64930b4bc8)
#02 pc 0000000000315bac /system/lib64/platformsdk/libark_jsruntime.so(95b2781bd3970de0ded17d64930b4bc8)
#03 pc 000000000041dc18 /system/lib64/platformsdk/libark_jsruntime.so(95b2781bd3970de0ded17d64930b4bc8)
#04 pc 00000000004649e8 /system/lib64/platformsdk/libark_jsruntime.so(panda::ecmascript::Marker::MarkRoots(unsigned int)+276)(95b2781bd3970de0ded17d64930b4bc8)
#05 pc 0000000000435f24 /system/lib64/platformsdk/libark_jsruntime.so(panda::ecmascript::ConcurrentMarker::InitializeMarking()+244)(95b2781bd3970de0ded17d64930b4bc8)
#06 pc 0000000000435c74 /system/lib64/platformsdk/libark_jsruntime.so(panda::ecmascript::ConcurrentMarker::Mark()+408)(95b2781bd3970de0ded17d64930b4bc8)
#07 pc 000000000044603c /system/lib64/platformsdk/libark_jsruntime.so(panda::ecmascript::Heap::TriggerConcurrentMarking()+108)(95b2781bd3970de0ded17d64930b4bc8)
#08 pc 0000000000449bdc /system/lib64/platformsdk/libark_jsruntime.so(panda::ecmascript::Heap::TryTriggerConcurrentMarking()+676)(95b2781bd3970de0ded17d64930b4bc8)
#09 pc 000000000044fb10 /system/lib64/platformsdk/libark_jsruntime.so(panda::ecmascript::LinearSpace::Allocate(unsigned long, bool)+164)(95b2781bd3970de0ded17d64930b4bc8)
#10 pc 00000000004f6600 /system/lib64/platformsdk/libark_jsruntime.so(panda::ecmascript::ObjectFactory::NewJSObject(panda::ecmascript::JSHandle<panda::ecmascript::JSHClass> const&)+132)(95b2781bd3970de0ded17d64930b4bc8)
#11 pc 00000000004f9e3c /system/lib64/platformsdk/libark_jsruntime.so(panda::ecmascript::ObjectFactory::NewJSFunctionByHClass(panda::ecmascript::JSHandle<panda::ecmascript::Method> const&, panda::ecmascript::JSHandle<panda::ecmascript::JSHClass> const&, panda::ecmascript::MemSpaceType)+76)(95b2781bd3970de0ded17d64930b4bc8)
#12 pc 0000000000500bb4 /system/lib64/platformsdk/libark_jsruntime.so(panda::ecmascript::ObjectFactory::NewJSFunction(panda::ecmascript::JSHandle<panda::ecmascript::GlobalEnv> const&, void const*, panda::ecmascript::FunctionKind, panda::ecmascript::kungfu::BuiltinsStubCSigns::ID, panda::ecmascript::MemSpaceType)+280)(95b2781bd3970de0ded17d64930b4bc8)
#13 pc 00000000004d8224 /system/lib64/platformsdk/libark_jsruntime.so(panda::FunctionRef::NewConcurrent(panda::ecmascript::EcmaVM*, panda::JSValueRef (*)(panda::JsiRuntimeCallInfo*), void (*)(void*, void*, void*), void*, bool, unsigned long)+172)(95b2781bd3970de0ded17d64930b4bc8)
#14 pc 000000000004c098 /system/lib64/platformsdk/libace_napi.z.so(napi_create_function+244)(b6e1f7201887fd380757eb122af83fe1)
#15 pc 00000000000710f0 /system/lib64/platformsdk/libruntime.z.so(OHOS::AbilityRuntime::BindNativeFunction(napi_env__*, napi_value__*, char const*, char const*, napi_value__* (*)(napi_env__*, napi_callback_info__*))+256)(56cc65f02638320d7fbdc380bac8683f)
#16 pc 0000000000018ea8 /system/lib64/platformsdk/libapp_context_utils.z.so(OHOS::AbilityRuntime::JsApplicationContextUtils::BindNativeApplicationContext(napi_env__*, napi_value__*)+784)(ce3fd3bc0e3ce3e5264485bbfe7d40ed)
#17 pc 0000000000018a0c /system/lib64/platformsdk/libapp_context_utils.z.so(OHOS::AbilityRuntime::JsApplicationContextUtils::CreateJsApplicationContext(napi_env__*)+600)(ce3fd3bc0e3ce3e5264485bbfe7d40ed)
#18 pc 00000000000184a4 /system/lib64/platformsdk/libapp_context_utils.z.so(OHOS::AbilityRuntime::JsApplicationContextUtils::OnGetApplicationContext(napi_env__*, OHOS::AbilityRuntime::NapiCallbackInfo&)+172)(ce3fd3bc0e3ce3e5264485bbfe7d40ed)
#19 pc 00000000000183c8 /system/lib64/platformsdk/libapp_context_utils.z.so(OHOS::AbilityRuntime::JsApplicationContextUtils::GetApplicationContext(napi_env__*, napi_callback_info__*)+96)(ce3fd3bc0e3ce3e5264485bbfe7d40ed)
#20 pc 00000000000359ac /system/lib64/platformsdk/libace_napi.z.so(panda::JSValueRef ArkNativeFunctionCallBack<true>(panda::JsiRuntimeCallInfo*)+220)(b6e1f7201887fd380757eb122af83fe1)
#21 pc 0000000000302054 /system/lib64/module/arkcompiler/stub.an(RTStub_PushCallArgsAndDispatchNative+40)
#22 at getApplicationContext (/usr1/hmos_for_system/src/increment/sourcecode/foundation/ability/ability_runtime/frameworks/js/napi/app/application_context/application_context.js:137:1)
#23 at anonymous (products/phone/src/main/ets/init/task/InitUDBTask.ets:24:26
HarmonyOS
赞
收藏 0
回答 1
待解决
相关问题
HarmonyOS 接口返回偶现空字段
113浏览 • 1回复 待解决
HarmonyOS media.AVPlayer偶现报错
100浏览 • 1回复 待解决
HarmonyOS 偶现app图标显示错误
226浏览 • 1回复 待解决
HarmonyOS 视频播放偶现 5400106 错误码
221浏览 • 1回复 待解决
HarmonyOS ArkTS调C++ 偶现方法找不到。
680浏览 • 1回复 待解决
HarmonyOS Webview页面偶现画面缩放异常,未占满全屏
15浏览 • 1回复 待解决
router.back调用时,偶现app自动退出
1825浏览 • 1回复 待解决
HarmonyOS context.getApplicationContext().resourceDir 返回值是空字符串
206浏览 • 1回复 待解决
HarmonyOS 使用定位偶现m_singleLocation is nullptr导致定位失败
410浏览 • 1回复 待解决
HarmonyOS 使用安全控件保存视频偶现弹出无相册权限
27浏览 • 1回复 待解决
webview点击导航返回按钮时,偶现app自动退出
2268浏览 • 1回复 待解决
HarmonyOS 上架审核页面偶现获取用户列表失败提示
282浏览 • 1回复 待解决
HarmonyOS 基于Navigation的路由管理替换Router首页偶现异常动画
555浏览 • 1回复 待解决
HarmonyOS Web设置mixedMode(MixedMode.All)偶现无法加载http图片
31浏览 • 1回复 待解决
HarmonyOS 半模态档位切换时,偶现ux无法完全展示出来
178浏览 • 1回复 待解决
HarmonyOS getApplicationContext() 注释问题
121浏览 • 1回复 待解决
HarmonyOS 使用RichText加载富文本字体太小,且加载富文本时偶现白屏无法显示富文本内容
285浏览 • 1回复 待解决
HarmonyOS同一个线程napi_create_ark_runtime 11次之后必现崩溃
448浏览 • 1回复 待解决
Context类型错误,报错401“The context must be a valid Context”
2474浏览 • 1回复 待解决
HarmonyOS 崩溃时,看不到崩溃栈和崩溃原因
202浏览 • 1回复 待解决
HarmonyOS Web组件偶现出现页面布局错乱
516浏览 • 1回复 待解决
HarmonyOS AES解密,偶现出错error code:17630001
213浏览 • 1回复 待解决
HarmonyOS HiAppEvent在进程崩溃时实时拿到崩溃
187浏览 • 1回复 待解决
具体分析可以参考文档,CppCrash故障定位指导:https://developer.huawei.com/consumer/cn/doc/best-practices-V5/bpta-cppcrash-guidance-V5