We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3274

Summary: SeparateEventsHintWatcher kills android application
Product: SDL Reporter: Imants <capsexe>
Component: eventsAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED WONTFIX QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: philipp.wiesemann
Version: 2.0.4   
Hardware: ARM   
OS: Android (All)   

Description Imants 2016-02-28 19:32:58 UTC
When SDL tries to perform:

  (*env)->SetStaticBooleanField(env, mActivityClass, fid, separate_mouse_and_touch ? JNI_TRUE : JNI_FALSE); in SDL_androidtouch.c

it gets and application crashes:

F/art     (18534): art/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: static jfieldID 0x8767b4c8 not valid for class java.lang.Class<com.pascal.opengltest.GameActivity>
F/art     (18534): art/runtime/check_jni.cc:65]     in call to SetStaticBooleanField
F/art     (18534): art/runtime/check_jni.cc:65]     from long android.app.NativeActivity.loadNativeCode(java.lang.String, java.lang.String, android.os.MessageQueue, java.lang.String, java.lang.String, java.lang.String, int, android.content.res.AssetManager, byte[])
F/art     (18534): art/runtime/check_jni.cc:65] "main" prio=5 tid=1 Runnable

I got workaround by replacing method with this:

static void
SeparateEventsHintWatcher(void *userdata, const char *name,
                          const char *oldValue, const char *newValue)
{
    jclass mActivityClass = Android_JNI_GetActivityClass();
    JNIEnv *env = Android_JNI_GetEnv();
    jmethodID fid = (*env)->GetStaticMethodID(env, mActivityClass, "setSeparateMouseAndTouch", "(Z)V");

    separate_mouse_and_touch = (newValue && (SDL_strcmp(newValue, "1") == 0));
    jboolean val = separate_mouse_and_touch ? JNI_TRUE : JNI_FALSE;
    (*env)->CallStaticVoidMethod(env, mActivityClass, fid, val);
}      

an creating in SDLActivity.java method:

    public static void setSeparateMouseAndTouch(boolean value)
    {
      mSeparateMouseAndTouch = value;
    }
Comment 1 Imants 2016-05-27 12:39:10 UTC
It started to work to me. I looks like I need to take libs from armeabi-v7a not just armeabi.