In the past few weeks ive been struggling to build my expo app when i install Veriff SDK, ive been using this library for over 6 months and it was working great, but suddenly after some gradle and java updates recently, it gives me errors when im trying to build the app on Android, on IOS works fine.
Im following the documentation https://developers.veriff.com/#react-native-sdk step by step, for IOS it works fine, but for android im getting the following error:
Task :veriff_react-native-sdk:compileDebugKotlin FAILED
node_modules/@veriff/react-native-sdk/android/src/main/java/com/veriff/sdk/reactnative/ReactNativeImageProvider.kt:44:47 Type mismatch: inferred type is Bitmap.Config? but Bitmap.Config was expected
Execution failed for task ':veriff_react-native-sdk:compileDebugKotlin'.
A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkA
I tried contacting Veriff directly but no response yet, maybe because of holidays, please let me know if i can provide more information that will be helpful solving this issue.
So i got in contact with Veriff team and they asked a some details about my environment, versions, outputs, debugs etc... so they can find the issue themselves and possibly come up with solution, either something wrong on my side or on their side.
However they provided a workaround that worked for me and i built the app successfully.
In the file
node_modules/@veriff/react-native-sdk/android/src/main/java/com/veriff/sdk/reactnative/ReactNativeImageProvider.kt
Change
override fun onNewResultImpl(bitmap: Bitmap?) {
if (bitmap == null) {
atomicResult.set(Result(IOException("Loaded bitmap was null")))
} else {
atomicResult.set(Result(bitmap.copy(bitmap.config, false)))
}
imageLoadLatch.countDown()
}
To:
override fun onNewResultImpl(bitmap: Bitmap?) {
if (bitmap == null) {
atomicResult.set(Result(IOException("Loaded bitmap was null")))
} else {
atomicResult.set(Result(bitmap.copy(bitmap.config, false)))
}
imageLoadLatch.countDown()
}
Keep in mind that after any new installation of new dependency or just simply npm install or yarn install, this will be overwritten so you have to re-do it again.
But the best solution is to contact the Veriff team via their live chat in the Veriff station or via email.