Menu

FingerprintTemplate Error in Android Studio

2019-05-16
2019-09-19
  • Quamarul Islam

    Quamarul Islam - 2019-05-16

    My code is here. I'm not using transparency. But all the errors are coming from there.

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_match_attendance);
    
        Bundle extras = getIntent().getExtras();
        finger_new = extras.getString("finger");
        finger_one = extras.getString("fingerOne");
        fingerPrev = (ImageView) findViewById(R.id.finger1);
        fingerNxt = (ImageView) findViewById(R.id.finger2);
    
        byte[] imageAsBytes = Base64.decode(finger_one.getBytes(), Base64.DEFAULT);
        fingerOne = BitmapFactory.decodeByteArray(imageAsBytes, 0, imageAsBytes.length);
        fingerPrev.setImageBitmap(fingerOne);
    
        byte[] imageAsBytes1 = Base64.decode(finger_one.getBytes(), Base64.DEFAULT);
        fingerTwo = BitmapFactory.decodeByteArray(imageAsBytes1, 0, imageAsBytes1.length);
        fingerNxt.setImageBitmap(fingerTwo);
    
        ByteArrayOutputStream stream = new ByteArrayOutputStream();
        fingerTwo.compress(Bitmap.CompressFormat.PNG, 100, stream);
        byte[] probeImage = stream.toByteArray();
    
        ByteArrayOutputStream stream1 = new ByteArrayOutputStream();
        fingerOne.compress(Bitmap.CompressFormat.PNG, 100, stream1);
        byte[] candidateImage = stream1.toByteArray();
    
        FingerprintTemplate probe = new FingerprintTemplate()
                    .dpi(500)
                    .create(probeImage);
            FingerprintTemplate candidate = new FingerprintTemplate()
                    .dpi(500)
                    .create(candidateImage);
            double score = new FingerprintMatcher()
                    .index(probe)
                    .match(candidate);
    
            double threshold = 40;
    
            if (score>=threshold){
                Toast.makeText(this, "Fingerprint Matches", Toast.LENGTH_SHORT).show();
            }
            else {
                Toast.makeText(this, "Not Matched", Toast.LENGTH_SHORT).show();
            }
    
    }
    

    The error log is:

    java.lang.VerifyError: Verifier rejected class com.machinezoo.sourceafis.FingerprintTransparency: java8.util.function.Supplier com.machinezoo.sourceafis.FingerprintTransparency.json(java8.util.function.Supplier) failed to verify: java8.util.function.Supplier com.machinezoo.sourceafis.FingerprintTransparency.json(java8.util.function.Supplier): [0x0] Call site #23 bootstrap return type is not a reference
         void com.machinezoo.sourceafis.FingerprintTransparency.logBooleanMap(java.lang.String, com.machinezoo.sourceafis.BooleanMap) failed to verify: void com.machinezoo.sourceafis.FingerprintTransparency.logBooleanMap(java.lang.String, com.machinezoo.sourceafis.BooleanMap): [0x6] Call site #21 bootstrap return type is not a reference
         void com.machinezoo.sourceafis.FingerprintTransparency.logDoubleMap(java.lang.String, com.machinezoo.sourceafis.DoubleMap) failed to verify: void com.machinezoo.sourceafis.FingerprintTransparency.logDoubleMap(java.lang.String, com.machinezoo.sourceafis.DoubleMap): [0x6] Call site #19 bootstrap return type is not a reference
         void com.machinezoo.sourceafis.FingerprintTransparency.logHistogram(java.lang.String, com.machinezoo.sourceafis.Histogram) failed to verify: void com.machinezoo.sourceafis.FingerprintTransparency.logHistogram(java.lang.String, com.machinezoo.sourceafis.Histogram): [0x6] Call site #15 bootstrap return type is not a reference
         void com.machinezoo.sourceafis.FingerprintTransparency.logMinutiae(java.lang.String, com.machinezoo.sourceafis.TemplateBuilder) failed to verify: void com.machinezoo.sourceafis.FingerprintTransparency.logMinutiae(java.lang.String, com.machinezoo.sourceafis.TemplateBuilder): [0x9] Call site #14 bootstrap return type is not a reference
         void com.machinezoo.sourceafis.FingerprintTransparency.logPointMap(java.lang.String, com.machinezoo.sourceafis.PointMap) failed to verify: void com.machinezoo.sourceafis.FingerprintTransparency.logPointMap(java.lang.String, com.machinezoo.sourceafis.PointMap): [0x6] Call site #17 bootstrap return type is not a reference
         void com.machinezoo.sourceafis.FingerprintTransparency.logSkeleton(java.lang.String, com.machinezoo.sourceafis.Skeleton) failed to verify: void com.machinezoo.sourceafis.FingerprintTransparency.logSkeleton(java.lang.String, com.machinezoo.sourceafis.Skeleton): [0x18] Call site #12 bootstrap return type is not a referenceVerifier rejected class com.machinezoo.sourceafis.FingerprintTransparency: void com.machinezoo.sourceafis.FingerprintTransparency.logBestMatch(int) failed to verify: void com.machinezoo.sourceafis.FingerprintTransparency.logBestMatch(int): [0xC] Call site #11 bootstrap return type is not a reference
         void com.machinezoo.sourceafis.FingerprintTransparency.logBlockMap(com.machinezoo.sourceafis.BlockMap) failed to verify: void com.machinezoo.sourceafis.FingerprintTransparency.logBlockMap(com.machinezoo.sourceafis.BlockMap): [0x6] Call site #4 bootstrap return type is not a reference
         void com.machinezoo.sourceafis.FingerprintTransparency.logEdgeHash(gnu.trove.map.hash.TIntObjectHashMap) failed to verify: void com.machinezoo.sourceafis.FingerprintTransparency.logEdgeHash(gnu.trove.map.hash.TIntObjectHashMap): [0x6] Call site #7 bootstrap return type is not a reference
         void com.machinezoo.sourceafis.FingerprintTransparency.logEdgeTable(com.machinezoo.sourceafis.NeighborEdge[][]) failed to verify: void com.machinezoo.sourceafis.FingerprintTransparency.logEdgeTable(com.machinezoo.sourceafis.NeighborEdge[][]): [0x6] Call site #5 bootstrap return type is not a reference
         void com.machinezoo.sourceafis.FingerprintTransparency.logIsoMetadata(int, int, int, int) failed to verify: void com.machinezoo.sourceafis.FingerprintTransparency.logIsoMetadata(int, int, int, int): [0xC] Call site #6 bootstrap return type is not a reference
    2019-05-16 23:29:43.740 9932-9932/com.manna.wft E/AndroidRuntime:  void com.machinezoo.sourceafis.FingerprintTransparency.logPairing(int, com.machinezoo.sourceafis.MinutiaPair[]) failed to verify: void com.machinezoo.sourceafis.FingerprintTransparency.logPairing(int, com.machinezoo.sourceafis.MinutiaPair[]): [0xC] Call site #9 bootstrap return type is not a reference
         void com.machinezoo.sourceafis.FingerprintTransparency.logRootPairs(int, com.machinezoo.sourceafis.MinutiaPair[]) failed to verify: void com.machinezoo.sourceafis.FingerprintTransparency.logRootPairs(int, com.machinezoo.sourceafis.MinutiaPair[]): [0xC] Call site #8 bootstrap return type is not a reference
         void com.machinezoo.sourceafis.FingerprintTransparency.logScore(com.machinezoo.sourceafis.Score) failed to verify: void com.machinezoo.sourceafis.FingerprintTransparency.logScore(com.machinezoo.sourceafis.Score): [0xC] Call site #10 bootstrap return type is not a reference (declaration of 'com.machinezoo.sourceafis.FingerprintTransparency' appears in base.apk)
            at com.machinezoo.sourceafis.FingerprintTemplate.<init>(FingerprintTemplate.java:34)
            at com.manna.wft.MatchAttendance.onCreate(MatchAttendance.java:60)
            at android.app.Activity.performCreate(Activity.java:7224)
            at android.app.Activity.performCreate(Activity.java:7213)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1272)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2926)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3081)
            at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
            at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
            at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1831)
            at android.os.Handler.dispatchMessage(Handler.java:106)
            at android.os.Looper.loop(Looper.java:201)
            at android.app.ActivityThread.main(ActivityThread.java:6810)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
    
     
  • Robert Važan

    Robert Važan - 2019-05-16

    What Android API level are you building against?

     
  • Quamarul Islam

    Quamarul Islam - 2019-05-16

    minSdkVersion 26
    targetSdkVersion 26

     
  • Robert Važan

    Robert Važan - 2019-05-16

    That should be high enough to support all the Java 8 features SourceAFIS needs. What's the value of compileSdkVersion?

    Check build tools version (buildToolsVersion) and try to upgrade to latest build tools.

     
  • Quamarul Islam

    Quamarul Islam - 2019-05-16
    compileSdkVersion 26
    buildToolsVersion "26.0.3"
    
     
  • Quamarul Islam

    Quamarul Islam - 2019-05-16

    App crashes here: http://prntscr.com/nphiw9

     
  • Quamarul Islam

    Quamarul Islam - 2019-05-16

    I tried upgrading the buildToolVersion to "28.0.3" the latest one.

     
  • Robert Važan

    Robert Važan - 2019-05-16

    I am running out of ideas. You will probably have to rebuild SourceAFIS from sources and remove/modify any parts that cause trouble.

    But I still think there is something wrong with your build. The stack trace mentions Java 8 functional interface. Java 8 features somehow aren't handled properly, but I don't know what is causing it.

     
  • Johan Hanekom

    Johan Hanekom - 2019-06-20

    Try addding adding the following compile options to your build.gradle file:

        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
    

    See working gradle build file below:

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 28
        defaultConfig {
            applicationId "a.e.poc.biometricandroid"
            minSdkVersion 24
            targetSdkVersion 28
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    
        }
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            }
        }
    }
    
    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'androidx.appcompat:appcompat:1.1.0-beta01'
        implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'androidx.test:runner:1.2.0'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    
        implementation 'com.google.code.gson:gson:2.8.5'
        implementation 'commons-io:commons-io:2.6'
        implementation 'net.sf.trove4j:trove4j:3.0.3'
        implementation 'com.machinezoo.noexception:noexception:1.3.2'
        implementation 'net.sourceforge.streamsupport:streamsupport:1.6.1'
        implementation group: 'com.github.mhshams', name: 'jnbis', version: '2.0.2'
    }
    
     

    Last edit: Johan Hanekom 2019-06-24
  • Robert Važan

    Robert Važan - 2019-09-19

    FYI, SourceAFIS 3.6.0 runs on Android API level 24+.

     

Log in to post a comment.