Skip to main content

Integration

For IOS Devices

Update Podfile

Since our SDK is an dynamic framework you have to update your Podfile for dynamic frameworks.

source "https://github.com/AmaniTechnologiesLtd/Mobile_SDK_Repo"
source "https://github.com/CocoaPods/Specs"

Building for devices that don’t support NFC

For not NFC supported device (like iPhone 6) there is no CoreNFC library in system and also we are using some ios crypto libraries for reading nfc data supported after iOS 13. You need to add below listed libraries as optional under Build Phases->Link Binary With Libraries menu. Even if you don't use the nfc process, you should add.

CoreNFC.framework
CryptoTokenKit.framework
CryptoKit.framework

For Android Devices

Integration

1. Add the SDK Dependency

Ensure your project is configured to use JitPack as a repository source.

Settings in settings.gradle:

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven {
url = "https://jfrog.amani.ai/artifactory/amani-sdk"
}
maven {
url = "https://jitpack.io"
}
}
}

Dependency in build.gradle:

Replace Tag with the latest appropriate release as Latest Release

implementation 'com.github.AMANI-AI-ORG:Android.SDK.UI:Tag'

2. Configure Gradle

Enable data binding and configure the aaptOptions block in your Android Gradle setup to prevent TensorFlow Lite model files (.tflite) from being compressed during APK packaging. This ensures that the model files remain directly accessible at runtime without decompression overhead. Additionally, exclude redundant or conflicting metadata files (such as META-INF/versions/9/OSGI-INF/MANIFEST.MF) from the final APK to avoid build-time merge issues when using certain libraries.

android {
// Enable data binding
dataBinding {
enabled = true
}

// Configure aaptOptions to prevent compression of .tflite files
aaptOptions {
noCompress "tflite"
}

// Exclude conflicting or unnecessary metadata to avoid build issues
packaging {
resources {
it.excludes += "META-INF/versions/9/OSGI-INF/MANIFEST.MF"
}
}
}

Gradle Properties

Disable R8 full mode, use AndroidX and enable Jetifier like below;

 android.enableR8.fullMode=false
android.useAndroidX=true
android.enableJetifier=true

ProGuard Rule Usage

  • If you are using ProGuard in your application, you just need to add this line into your ProGuard Rules!
    -keep class ai.** {*;}
-dontwarn ai.**
-keep class datamanager.** {*;}
-dontwarn datamanager.**
-keep class networkmanager.** {*;}
-dontwarn networkmanager.**
-keep class ai.amani.jniLibrary.CroppedResult.**{*;}

-keep class org.jmrtd.** {*;}
-keep class net.sf.scuba.** {*;}
-keep class org.bouncycastle.** {*;}
-keep class org.spongycastle.** {*;}
-keep class org.ejbca.** {*;}

-dontwarn org.ejbca.**
-dontwarn org.bouncycastle.**
-dontwarn org.spongycastle.**
-dontwarn org.jmrtd.**
-dontwarn net.sf.scuba.**

-keep class org.tensorflow.lite**{ *; }
-dontwarn org.tensorflow.lite.**
-keep class org.tensorflow.lite.support**{ *; }
-dontwarn org.tensorflow.lite.support**