'Calling Kotlin methods from C++ with JNI
I have following problem:
I have android project with c++ core and kotlin ui. At the moment cross-language bridging is implemented through jni, which works with auto-generated interface and structures in java, that are imported or implemented in Kotlin. I want to get rid of Java in that construction and work directly with generated kotlin code, but I have following problem:
I have following data structure:
class CommonParams
(var deviceIds: HashMap<String, String>?,
var device: String?,
var machineName: String?,
var onlyAccount: Boolean?,
var currentClient: Int?,
var appClientId: String?,
var appSecret: String?,
var needHierarchy: Boolean?,
var originDeviceId: String?)
{}
When it was in Java I got its constructor as:
<init>(Ljava/util/HashMap;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/Int;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/String;)V
Now I'm getting exception, that there is no such method. I think that problem is with HashMap, but I'm not sure. I've already tried to replace Ljava/util/HashMap with Lkotlin/collections/HashMap, with no result. What will be proper way to import this method from Kotlin through JNI? Or is there any documentation on difference between Java and Kotlin JNI?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
