Search code examples
javaandroidgradlejna

java.lang.UnsatisfiedLinkError: Can't obtain class com.sun.jna.Pointer (Neurotechnology Megamatcher SDK)


I want to try combine multibiometric sample android (from https://www.neurotechnology.com/download.html#megamatcher_verifinger_verilook_verieye_sdk_trial) into my project.

I already copy source to my project, and add all gradle depedencies. When build apk , this error was appear :

java.lang.UnsatisfiedLinkError: Can't obtain class com.sun.jna.Pointer

when I debug the error, the error was when try to call this code :

NLicenseManager.setTrialMode(LicensingPreferencesFragment.isUseTrial(this));

and if I comment that code, the same error still appear but in this code :

NCore.setContext(this);

this is my gradle implementation library :

//for my project
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'

    implementation 'com.android.support:mediarouter-v7:27.1.1'
    implementation 'org.greenrobot:greendao:3.2.2'
    implementation 'com.github.yuweiguocn:GreenDaoUpgradeHelper:v2.0.2'
    implementation 'com.jakewharton:butterknife:7.0.1'

    implementation 'com.google.firebase:firebase-appindexing:17.1.0'
    implementation 'com.google.android.gms:play-services-maps:16.1.0'
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    implementation 'com.journeyapps:zxing-android-embedded:3.6.0'
    implementation 'com.google.zxing:core:3.3.2'

    implementation 'com.github.dmytrodanylyk.android-process-button:library:1.0.4'

    implementation files('libs/volley.jar')
    implementation files('libs/httpclient-4.5.2.jar')
    implementation files('libs/httpcore-4.4.4.jar')
    implementation files('libs/httpmime-4.5.2.jar')

    implementation files('libs/commons-io-2.6.jar')
    implementation 'com.hrules:horizontalnumberpicker:1.1.1'
    implementation 'com.afollestad.material-dialogs:commons:0.9.6.0'
    implementation 'com.github.cdflynn:checkview:v1.1'
    api 'io.jsonwebtoken:jjwt-api:0.10.5'
    runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.10.5'
    runtimeOnly('io.jsonwebtoken:jjwt-orgjson:0.10.5') {
        exclude group: 'org.json', module: 'json' 
    }



// for megamatcher multiobiometric 
        implementation ":neurotec-biometrics-client-android"
        implementation ":neurotec-devices-fscanners-nitgen-android"
        implementation ":neurotec-devices-fscanners-aratek-android"
        implementation ":neurotec-devices-fscanners-aratek-trustfinger-android"
        implementation ":neurotec-devices-fscanners-suprema-biomini-android"
        implementation ":neurotec-devices-fscanners-bluefin-android"
        implementation ":neurotec-devices-multimodal-credenceid-android"
        implementation ":neurotec-devices-fscanners-digitalpersona-uareu-android"
        implementation ":neurotec-devices-fscanners-secugen-android"
        implementation ":neurotec-devices-fscanners-futronic-android"
        implementation ":neurotec-devices-fscanners-integratedbiometrics-android"
        implementation ":neurotec-devices-fscanners-smufsbio-android"
        implementation ":neurotec-devices-fscanners-startek-android"
        implementation ":neurotec-devices-fscanners-nextbiometrics-android"
        implementation ":neurotec-devices-fscanners-greenbit-android"
        implementation ":neurotec-devices-fscanners-zkteco-android"
        implementation ":neurotec-devices-irisscanners-iritech-irishield-android"
        implementation ":neurotec-devices-irisscanners-mantra-android"
        implementation ":neurotec-devices-media-android"
        implementation ":neurotec-biometrics-android"
        implementation ":neurotec-devices-android"
        implementation(name:'neurotec-biometrics-gui-android', ext:'aar')
        implementation project(":samples-utils")

//inside samples-utils
    api ":neurotec-core-android"
    api ":neurotec-licensing-android"
    api ":neurotec-gui-android"
    api ":neurotec-media-android"
    api ":neurotec-media-processing-android"
    api ":jna"
    api "com.android.support:support-v4:27.1.1"
    api(name:'neurotec-licensing-gui-android', ext:'aar')

I already check that I already call implementation of jna jar in the gradle, anybody can help ?


Solution

  • Finally, after some day I found out that the problem is if our application use shrinkResources true and minifyEnabled true, we should add some exception in our proguard rule for all library that megamatcher used, like this :

    -keep class com.sun.jna.** { *; }
    
    -keep class org.libusb.** { *; }
    
    -keep class com.neurotec.** { *; }
    
    -keep class cn.com.aratek.** { *; }
    
    -keep class com.aratek.** { *; }
    -keep class com.cognaxon.** { *; }
    
    -keep class com.digitalpersona.uareu.** { *; }
    
    -keep class com.futronictech.** { *; }
    
    -keep class com.greenbit.** { *; }
    -keep class com.integratedbiometrics.** { *; }
    -keep class com.nextbiometrics.fingerprint.NXTSensor.** { *; }
    -keep class com.SecuGen.** { *; }
    -keep class com.smufsbio.** { *; }
    -keep class com.startek.fp300u.** { *; }
    -keep class com.android.biomini.** { *; }
    -keep class com.suprema.** { *; }
    -keep class com.zkteco.** { *; }
    -keep class com.zkteco.** { *; }
    
    -keep class com.iritech.** { *; }
    -keep class com.mantra.mis100.** { *; }
    -keep class com.credenceid.** { *; }
    -keep class com.gstreamer.** { *; }