iink SDK on Device

Answered

java.lang.UnsatisfiedLinkError: JNI_ERR

The release version of the my application throws an error after running, the application adds proGuard,  it could run normally if not add or BuildVariant is debug.

  error:

  java.lang.UnsatisfiedLinkError: JNI_ERR returned from JNI_OnLoad in "/data/app/com.eningqu.aipen-otgcDn8WTM2cl-5wm6RVTw==/lib/arm64/libiink.so"

        at java.lang.Runtime.loadLibrary0(Runtime.java:1016)

        at java.lang.System.loadLibrary(System.java:1660)

        at com.myscript.iink.m.b(NativeLibrary.java:20)

        at com.myscript.iink.m.<clinit>(NativeLibrary.java:26)

        at com.myscript.iink.m.a(Unknown Source:0)

        at com.myscript.iink.NativeFunctions.<clinit>(NativeFunctions.java:21)

        at com.myscript.iink.NativeFunctions.createEngine(Native Method)

        at com.myscript.iink.h.<init>(Engine.java:20)

        at com.myscript.iink.h.a(Engine.java:39)

        at com.eningqu.aipen.e.b.d(IInkSdkManager.java:70)

        at com.eningqu.aipen.e.b.a(IInkSdkManager.java:82)

        at com.eningqu.aipen.SmartPenApp.c(SmartPenApp.java:67)

        at com.eningqu.aipen.SmartPenApp.onCreate(SmartPenApp.java:39)

        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1123)

        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6636)

        at android.app.ActivityThread.-wrap2(Unknown Source:0)

        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2084)

        at android.os.Handler.dispatchMessage(Handler.java:109)

        at android.os.Looper.loop(Looper.java:166)

        at android.app.ActivityThread.main(ActivityThread.java:7555)

        at java.lang.reflect.Method.invoke(Native Method)

        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:469)

        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:963)



app build.gradle

defaultConfig {

        ...

        ndk {

            abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'

        }

    }


buildTypes {

        release {

            minifyEnabled true

            shrinkResources true

            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

// signingConfig signingConfigs.release

        }

        debug {

            minifyEnabled false

            shrinkResources false

            signingConfig signingConfigs.NQ

            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

        }

    }


Best Answer

Dear Chad li,


Thank you for your request.

This error is most likely due to the fact some iink sdk classes call methods from the Java Native Interface (JNI), so the iink sdk code should be kept.

To fix this issue, add a -keep line in the ProGuard rules file for the com.myscript.iink package to make sure the corresponding code is kept.

Best Regards,

Gwenaëlle




Answer

Dear Chad li,


Thank you for your request.

This error is most likely due to the fact some iink sdk classes call methods from the Java Native Interface (JNI), so the iink sdk code should be kept.

To fix this issue, add a -keep line in the ProGuard rules file for the com.myscript.iink package to make sure the corresponding code is kept.

Best Regards,

Gwenaëlle



Thanks for your answer,the problem has been resolved