Search code examples
androidlinphone

linphone android login error java.lang.UnsatisfiedLinkError: setUsername


linphone for android compiled success,and I import the "linphone-android" project to Eclipse,run it in my android phone.But when I add a account or login,throw a exception:

No implementation found for native Lorg/linphone/core/LinphoneAuthInfoImpl;.setUsername (JLjava/lang/String;) java.lang.UnsatisfiedLinkError: setUsername

linphone-android libs Directory

I think the question is have not load .so librarys,Log shows:

No JNI_OnLoad found in /data/data/org.linphone/lib/libxxx.so

Solution

  • Please try this solution:

    Go to submodules/linphone/coreapi/linphonecore_jni.cc

    Edit linphonecore_jni.cc file.

    The change is - replace JNIEXPORT with extern "C" and remove JNICALL keyword in all this getter / setters of linphone auth info.

    /*
     * Class:     org_linphone_core_LinphoneAuthInfoImpl
     * Method:    setUsername
     * Signature: (JLjava/lang/String;)V
     */
    extern "C" void Java_org_linphone_core_LinphoneAuthInfoImpl_setUsername (JNIEnv *env, jobject, jlong auth_info, jstring jusername) {
    const char* username = jusername?env->GetStringUTFChars(jusername, NULL):NULL;
    linphone_auth_info_set_username((LinphoneAuthInfo*)auth_info,username);
    if (username) env->ReleaseStringUTFChars(jusername, username);
    }
    

    refer to Kaushik Parmar's solution.