AndroLua on Lollipop: JNI DETECTED ERROR IN APPLICATION: can't call static int org.keplerproject.luajava.LuaJavaAPI.javaNew(int, java.lang.Class)

933 views Asked by At

I want to use AndroLua as library in my Android application.

Everything goes well on Android version except Android 5.x (Lollipop)

But my app crashed under Lollipop if I call juajava.new lua function. The logcat shows

JNI DETECTED ERROR IN APPLICATION: can't call static int org.keplerproject.luajava.LuaJavaAPI.javaNew(int, java.lang.Class) on class java.lang.Class<java.lang.Class>

How can I solve the problem? Or is there alternative to run lua in Android?

1

There are 1 answers

0
Vadim Peretokin On

https://github.com/jasonsantos/luajava/issues/10 fixes the bug:

Calling luajava.new(...) produce the following error on Android ART: A/art: art/runtime/java_vm_ext.cc:410] JNI DETECTED ERROR IN APPLICATION: can't call static int org.keplerproject.luajava.LuaJavaAPI.javaNew(int, java.lang.Class) with class java.lang.Class A/art: art/runtime/java_vm_ext.cc:410] in call to CallStaticIntMethod

After some code review, I figured out the problem. In luajava.c, line 1377: ret = ( *javaEnv )->CallStaticIntMethod( javaEnv , clazz , method , (jint)stateIndex , classInstance ); "clazz" is not the object we want here. It should be: ret = ( *javaEnv )->CallStaticIntMethod( javaEnv , luajava_api_class , method , (jint)stateIndex , classInstance );

Moreover, I think, line 1371: if ( clazz == NULL || method == NULL ) should be: if ( luajava_api_class == NULL || method == NULL )

Nir.