对于使用Kotlin的方法,jmethodID为NULL
即使方法存在,我正在使用本机库,并有以下例外。 我有一个nativeInit函数也被导出到MapController,并按预期工作。 但是,nativeLoadScene方法会导致错误。
JNI DETECTED ERROR IN APPLICATION: jmethodID was NULL in call to CallObjectMethodV from int com.demo.lib.MyController.nativeLoadScene(long, java.lang.String, java.lang.String[])
JNI方法
JNIEXPORT jint JNICALL Java_com_demo_lib_MyController_nativeInit(JNIEnv *jniEnv, jobject obj, jobject tangramInstance, jobject assetManager) { ... } JNIEXPORT jint JNICALL Java_com_demo_lib_MyController_nativeLoadScene(JNIEnv* jniEnv, jobject obj, jlong mapPtr, jstring path, jobjectArray updateStrings) { ... }
com.demo.lib.MyController.kt
companion object { init { System.loadLibrary("c++_shared") } } // this works external fun nativeInit(instance: MapController, assetManager: AssetManager?): Long // this gives error external fun nativeLoadScene(mapPtr: Long, path: String, updateStrings: Array?): Int
- 无法在android中为微调器设置OnItemClickListener
- 如何使用kotlin创建在构造函数中传递方法引用的泛型类的实例
- 当链接从Observable.create()创建的Observable时,RxJava用户onNext / onError / onComplete没有被调用
- Kotlin在Android Studio 3.0 Canary 2中使用Android DataBinding
- Android设备版本的React-Native项目没有更新,即使模拟器是
- 广播接收器在应用程序类android中
- 不幸的是,“应用程序名称”已经停止因为Jsoup库
- ListView可以出现在Activity中,但不能出现在Fragment中
- Kotlin IllegalStateException:在类路径中找不到资源:kotlin / .kotlin_string_table