Home > Software design >  unable to integrate Persona SDK in flutter
unable to integrate Persona SDK in flutter

Time:09-16

in my project i want to implementing liveliness(selfie)detection by Persona. for this i was use persona_flutter in v2 channel. but its crash after i open camera and taking a picture.

when i saw persona android sdk demo code,that provide in main side its working properly. persona-android-sdk

Project link is here https://github.com/jorgefspereira/persona_flutter/tree/v2

and in this project persona dependecy version is,

implementation "com.withpersona.sdk2:inquiry:2.2.9"

but, as per persona documentation updated version we need to use.

implementation "com.withpersona.sdk2:inquiry:2.2.34"

but when i will updating this library lot of gradle issues arises.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Failed to transform moshi-1.13.0.jar (com.squareup.moshi:moshi:1.13.0) to match attributes {artifactType=enumerated-runtime-classes, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.environment=standard-jvm, org.gradle.jvm.version=8, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime, org.jetbrains.kotlin.platform.type=jvm}.
      > Execution failed for JetifyTransform: /home/deq/.gradle/caches/modules-2/files-2.1/com.squareup.moshi/moshi/1.13.0/da685586facab9eb5c4fb630ce248be14e7da21b/moshi-1.13.0.jar.
         > Failed to transform '/home/deq/.gradle/caches/modules-2/files-2.1/com.squareup.moshi/moshi/1.13.0/da685586facab9eb5c4fb630ce248be14e7da21b/moshi-1.13.0.jar' using Jetifier. Reason: IllegalArgumentException, message: Unsupported class file major version 60. (Run with --stacktrace for more details.)
           Suggestions:
            - Check out existing issues at https://issuetracker.google.com/issues?q=componentid:460323&s=modified_time:desc, it's possible that this issue has already been filed there.
            - If this issue has not been filed, please report it at https://issuetracker.google.com/issues/new?component=460323 (run with --stacktrace and provide a stack trace if possible).

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s
Exception: Gradle task assembleDebug failed with exit code 1

even when i solve this issue with some research lot of other issue are arrising because my library verions is to older as compare to newer.

CodePudding user response:

Seems like there is an outdated Gradle version. I clone the Persona flutter project from GitHub.

Yes the project is working fine in version 2.2.9

implementation "com.withpersona.sdk2:inquiry:2.2.9"

But having an issue with version 2.2.34

implementation "com.withpersona.sdk2:inquiry:2.2.34"

I have seen the Persona android SDK v2 changelog https://docs.withpersona.com/docs/android-sdk-v2-changelog

where I found the recent releases, which are working on the latest Gradle version which you can see by cloning Persona Android SDK https://github.com/persona-id/persona-android-sdk

I follow the same and the issue resolved

Steps to resolve

  1. Update kotlin version

    ext.kotlin_version = '1.7.10'

  2. Update classpath

from

classpath 'com.android.tools.build:gradle:4.1.2'

to

classpath 'com.android.tools.build:gradle:7.2.2'
  1. Remove compile options

     compileOptions {
     sourceCompatibility JavaVersion.VERSION_1_8
     targetCompatibility JavaVersion.VERSION_1_8
     }
    
  2. Update the gradle-wrapper.properties to the latest 7.3.3 version

     distributionBase=GRADLE_USER_HOME
     distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
     distributionPath=wrapper/dists
     zipStorePath=wrapper/dists
     zipStoreBase=GRADLE_USER_HOME
    
  3. At last, you need to update the persona to the latest 2.2.37

    implementation "com.withpersona.sdk2:inquiry:2.2.37"

  4. Now build the project.

  • Related