{"action":"closed","issue":{"url":"https://api.github.com/repos/JetBrains/kotlin-native/issues/2331","repository_url":"https://api.github.com/repos/JetBrains/kotlin-native","labels_url":"https://api.github.com/repos/JetBrains/kotlin-native/issues/2331/labels{/name}","comments_url":"https://api.github.com/repos/JetBrains/kotlin-native/issues/2331/comments","events_url":"https://api.github.com/repos/JetBrains/kotlin-native/issues/2331/events","html_url":"https://github.com/JetBrains/kotlin-native/issues/2331","id":381106066,"node_id":"MDU6SXNzdWUzODExMDYwNjY=","number":2331,"title":"How do I access JavaVM from androidNativeArm32 without NativeActivity and from a library?","user":{"login":"Syrou","id":4949225,"node_id":"MDQ6VXNlcjQ5NDkyMjU=","avatar_url":"https://avatars2.githubusercontent.com/u/4949225?v=4","gravatar_id":"","url":"https://api.github.com/users/Syrou","html_url":"https://github.com/Syrou","followers_url":"https://api.github.com/users/Syrou/followers","following_url":"https://api.github.com/users/Syrou/following{/other_user}","gists_url":"https://api.github.com/users/Syrou/gists{/gist_id}","starred_url":"https://api.github.com/users/Syrou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Syrou/subscriptions","organizations_url":"https://api.github.com/users/Syrou/orgs","repos_url":"https://api.github.com/users/Syrou/repos","events_url":"https://api.github.com/users/Syrou/events{/privacy}","received_events_url":"https://api.github.com/users/Syrou/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-11-15T10:54:19Z","updated_at":"2018-11-16T12:18:38Z","closed_at":"2018-11-16T12:18:38Z","author_association":"NONE","body":"Following the example demonstrated in: https://github.com/JetBrains/kotlin-native/blob/master/samples/androidNativeActivity\r\n\r\nI got the main idea on how to call Android API's from native code, however. I can not rely on NativeActivity being used and need some sort of way to gain access to JavaVM\r\n\r\nMy current idea is to setup the library with\r\n\r\n```\r\n@CName(\"JNI_OnLoad\")\r\nfun JNI_OnLoad(vm: kotlinx.cinterop.CValuesRef<platform.android.JavaVMVar>?, reserved: kotlinx.cinterop.CValuesRef<*>?): platform.android.jint {\r\n    __android_log_write(ANDROID_LOG_INFO.convert(), \"KonanActivity\", \"JNI BOOTED UP!\")\r\n    return JNI_VERSION_1_2\r\n}\r\n\r\n@CName(\"JNI_OnUnload\")\r\nfun JNI_OnUnload(vm: kotlinx.cinterop.CValuesRef<platform.android.JavaVMVar >?, reserved: kotlinx.cinterop.CValuesRef<*>?): kotlin.Unit {\r\n    __android_log_write(ANDROID_LOG_INFO.convert(), \"KonanActivity\", \"JNI SHUT DOWN!\")\r\n}\r\n```\r\nIn order to gain access to the JavaVM and then proceed to setting it up like in the repository linked above.\r\n\r\nHowever this will cause issues to the exported *.so file because the types won't be handled properly. What would be the easiest way to gain access to the JavaVM the library is attached to?"}}
{"actor":{"display_login":"Syrou"}}