luajava
luajava copied to clipboard
luajava.new(...) produce error on Android ART
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<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.
Yes, I got this bug too.
I've faced the same problem. Thanks for the solution, but this project looks like it's no longer being maintained
Thanks, that worked for me as well.
Since this project is no longer being maintained, I have forked this project and fixed some bugs. See here: https://github.com/nirhal/JLua
@nirhal , your fork has too much in one commit :( Do you think new users should go on patching this luajava code or jump right into your JLua? guys?
BTW looks like @stevedonovan and @mkottman took care of this in AndroLua project. I adapted their works to luajava layout.