java.lang.UnsatisfiedLinkError:无法获取com.sun.jna.Pointer类(神经技术Megamatcher SDK)

时间:2019-07-12 10:59:33

标签: java android gradle jna

我想尝试将多生物学示例android(来自https://www.neurotechnology.com/download.html#megamatcher_verifinger_verilook_verieye_sdk_trial)组合到我的项目中。

我已经将源代码复制到我的项目中,并添加了所有gradle操作。生成apk时,出现此错误:

  

java.lang.UnsatisfiedLinkError:无法获取com.sun.jna.Pointer类

当我调试错误时,错误是当尝试调用此代码时:

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

如果我注释该代码,则在此代码中仍会出现相同的错误:

NCore.setContext(this);

这是我的gradle实现库:

//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')

我已经检查过是否已经在gradle中调用了jna jar的实现,任何人都可以帮忙吗?

1 个答案:

答案 0 :(得分:0)

最后,一天后,我发现问题在于如果我们的应用程序使用rinkresources true和minifyEnabled true,我们应该在proguard规则中为megamatcher使用的所有库添加一些例外,如下所示:

-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.** { *; }