Android: How to call ndk function from Kotlin?
Kotlin :
call method from ndk file
external fun stringFromJNI(): String
load c++ file
companion object {
init {
System.loadLibrary("native-lib")
}
}
Put external fun stringFromNative(): String
outside of the companion object and into the MainActivity
.
(I found the answer by looking at https://github.com/ligee/kotlin-ndk-samples)