Include the library

The Passio Android SDK is shipped in the form of an .aar file.

Download the .aar from our distribution repository

  • Visit the releases page of the Android-Passio-SDK-Distribution GitHub repository. Download the passiolib-release.aar file from the latest release.

  • If you don't have access to the repository please contact our support team at support@passiolife.com

Include the .aar in your Android Studio project

To include the .aar file into your project go to the module that will contain the food recognition feature. Place the .aar file in the libs folder of the module. If the libs folder is missing, create one. Reference the .aar file in the build.gradle file of the implementing module.

implementation files('libs/passiolib-release.aar')

Sync Project with Gradle Files and be sure that you can reference the PassioSDK class within your code.

Dependencies

Passio Android SDK is powered by TensorFlow and FirebaseVision with the camera being managed by CameraX. Add the dependencies to these three projects by adding these lines to the module's build.gradle file.

dependencies {
    // TensorFlow
    implementation 'org.tensorflow:tensorflow-lite:2.8.0'
    implementation 'org.tensorflow:tensorflow-lite-metadata:0.4.0'

    // CameraX
    def camerax_version = "1.3.0-alpha12"
    implementation "androidx.camera:camera-core:$camerax_version"
    implementation "androidx.camera:camera-camera2:$camerax_version"
    implementation "androidx.camera:camera-lifecycle:$camerax_version"
    implementation 'androidx.camera:camera-view:1.3.0-alpha02'
    implementation 'androidx.camera:camera-extensions:1.3.0-alpha02'

    // Barcode and OCR
    implementation 'com.google.android.gms:play-services-mlkit-text-recognition:18.0.2'
    implementation 'com.google.android.gms:play-services-mlkit-barcode-scanning:18.1.0'
}

In order for the SDK to work add the following lines to the android section of the module's build.gradle file.

android {
    aaptOptions {
        noCompress "passiosecure"
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

Running Sync Project with Gradle Files will enable access to the SDK.

If at any point you need help from the Passio team, please reach out to us at support@passiolife.com

Last updated