-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
鸿蒙 MMKV.initialize() 报 Error message:Cannot read property initialize of undefined #1456
Comments
It's a typically NAPI error due to failing to load the native library limmkv.so. You check out Hilog/FaultLog and find out what went wrong. |
Did you turn on obfuscation? Have you followed the temp solution here? |
Does your simulator have OHOS API level 12 or above? aka HarmonyOS NEXT. |
One more thing, MMKV does not support x86 with 32-bit arch, only x86-64 is supported. |
不好意思,是引用的放错位置,应该放置dependencies下,而不是devDependencies。 |
1、"@tencent/mmkv": "^2.0.1"
2、onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
MMKV.initialize(this.context.getApplicationContext(), MMKVLogLevel.LevelInfo)
}
3、
Error name:TypeError
Error message:Cannot read property initialize of undefined
Stacktrace:
at initializeWithPath (oh_modules/.ohpm/@Tencent[email protected]/oh_modules/@tencent/mmkv/src/main/ets/utils/MMKV.ets:86:26)
at initialize (oh_modules/.ohpm/@Tencent[email protected]/oh_modules/@tencent/mmkv/src/main/ets/utils/MMKV.ets:70:16)
at onCreate (entry/src/main/ets/entryability/EntryAbility.ets:11:5)
The text was updated successfully, but these errors were encountered: