Accessing value by native code but getting error #833
Replies: 7 comments 3 replies
-
The Java example is not recommended and was written there because of requests. I suggest to move to Kotlin, so that it's easier to know what's wrong. |
Beta Was this translation helpful? Give feedback.
-
@krizzu I tried but I'm very newbie of kotlin, I searched sth like: "use suspend kotlin function from java" but still didn't find anything |
Beta Was this translation helpful? Give feedback.
-
@dattmahiho: Does the docs help: https://react-native-async-storage.github.io/async-storage/docs/advanced/brownfield#kotlin-recommended @krizzu: Is the docs here clear enough? Do we need to add more details? |
Beta Was this translation helpful? Give feedback.
-
@tido64 the docs is good but I'm not :( I don't know how to integrate kotlin in java |
Beta Was this translation helpful? Give feedback.
-
There are some docs here for adding Kotlin to existing projects with samples you can look at: https://developer.android.com/kotlin/add-kotlin Unfortunately, I'm not much of an Android expert myself so I will convert this issue to a discussion thread so others may be able to help you. |
Beta Was this translation helpful? Give feedback.
-
@tido64 I did it, adding kotlin dependencies carefully and call suspend function from java is the key |
Beta Was this translation helpful? Give feedback.
-
@tido64 sr, but how about ios? I got a exception |
Beta Was this translation helpful? Give feedback.
-
I've followed this docs: https://react-native-async-storage.github.io/async-storage/docs/advanced/brownfield/ for accessing my appTheme in local storage, but in resumeWith(@NotNull Object o), I logged it in logcat, it showed:
Failure(kotlinx.coroutines.JobCancellationException: StandaloneCoroutine has completed normally; job=StandaloneCoroutine{Completed}@7136858)
I tried both store appTheme by string and stringify but still have error, what did I do wrong?
Here is MyMainActivity's calling:
Reading value function:
Beta Was this translation helpful? Give feedback.
All reactions