aws-amplify / amplify-ui-android

Amplify UI for Android is a collection of accessible, themeable, performant Android components that can connect directly to the cloud.
https://ui.docs.amplify.aws
Apache License 2.0
13 stars 7 forks source link

FaceLivenessDetector crashs on Android15 ( with 16kb page size support) #161

Open vegeta2102 opened 3 months ago

vegeta2102 commented 3 months ago

Before creating a new issue, please confirm:

Which UI component?

Liveness

Gradle script dependencies

amplify-ui-liveness = { group = "com.amplifyframework.ui", name = "liveness", version.ref = "amplifyUi" }
amplifyUi = "1.2.1"

Environment information

Welcome to Gradle 8.6!

Here are the highlights of this release:
 - Configurable encryption key for configuration cache
 - Build init improvements
 - Build authoring improvements

For more details see https://docs.gradle.org/8.6/release-notes.html

------------------------------------------------------------
Gradle 8.6
------------------------------------------------------------

Build time:   2024-02-02 16:47:16 UTC
Revision:     d55c486870a0dc6f6278f53d21381396d0741c6e

Kotlin:       1.9.20
Groovy:       3.0.17
Ant:          Apache Ant(TM) version 1.10.13 compiled on January 4 2023
JVM:          17.0.11 (Amazon.com Inc. 17.0.11+9-LTS)
OS:           Mac OS X 13.6.7 aarch64

Please include any relevant guides or documentation you're referencing

https://ui.docs.amplify.aws/android/connected-components/liveness

Describe the bug

In order to update Android 15 release next year I'm trying to build app on an emulator with Android 15 with support for 16KB page sizes. Doc : https://developer.android.com/guide/practices/page-sizes My app crashs on emultor Android 15( 16kb page size support)

Reproduction steps (if applicable)

  1. Setup Android 15(with 16kb page size) Refer : https://developer.android.com/guide/practices/page-sizes#16kb-emulator
  2. Build app on this emulator
  3. App crashs when FaceLivenessDetector is called

Code Snippet

Refer to this sample to implement https://ui.docs.amplify.aws/android/connected-components/liveness

FaceLivenessDetector(
              sessionId = uiState.sessionId.value,
              region = uiState.region,
              credentialsProvider = uiState.credentials,
              disableStartView = true,
              onComplete = {
                onComplete(uiState.sessionId)
              },
              onError = onError,
            )

Log output

06-16 11:18:53.028  6274  6274 E AndroidRuntime: FATAL EXCEPTION: main
06-16 11:18:53.028  6274  6274 E AndroidRuntime: Process: jp.eure.android.pairs, PID: 6274
06-16 11:18:53.028  6274  6274 E AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: empty/missing DT_HASH/DT_GNU_HASH in "/data/app/~~shtzegI7w4XzXSxFGAbw5g==/com.sample-bXldvDr8EVQncikams3wsQ==/base.apk!/lib/arm64-v8a/libliveness_opengl_renderer_jni.so" (new hash type from the future?)
06-16 11:18:53.028  6274  6274 E AndroidRuntime:    at java.lang.Runtime.loadLibrary0(Runtime.java:1081)
06-16 11:18:53.028  6274  6274 E AndroidRuntime:    at java.lang.Runtime.loadLibrary0(Runtime.java:1003)
06-16 11:18:53.028  6274  6274 E AndroidRuntime:    at java.lang.System.loadLibrary(System.java:1765)
06-16 11:18:53.028  6274  6274 E AndroidRuntime:    at com.amplifyframework.ui.liveness.camera.OpenGLRenderer.<clinit>(OpenGLRenderer.java:57)
06-16 11:18:53.028  6274  6274 E AndroidRuntime:    at com.amplifyframework.ui.liveness.camera.LivenessCoordinator.<init>(LivenessCoordinator.kt:127)
06-16 11:18:53.028  6274  6274 E AndroidRuntime:    at com.amplifyframework.ui.liveness.ui.FaceLivenessDetectorKt$ChallengeView$1.invoke(FaceLivenessDetector.kt:166)
06-16 11:18:53.028  6274  6274 E AndroidRuntime:    at com.amplifyframework.ui.liveness.ui.FaceLivenessDetectorKt$ChallengeView$1.invoke(FaceLivenessDetector.kt:165)
06-16 11:18:53.028  6274  6274 E AndroidRuntime:    at androidx.compose.runtime.DisposableEffectImpl.onRemembered(Effects.kt:83)
06-16 11:18:53.028  6274  6274 E AndroidRuntime:    at androidx.compose.runtime.CompositionImpl$RememberEventDispatcher.dispatchRememberObservers(Composition.kt:1295)
06-16 11:18:53.028  6274  6274 E AndroidRuntime:    at androidx.compose.runtime.CompositionImpl.applyChangesInLocked(Composition.kt:984)
06-16 11:18:53.028  6274  6274 E AndroidRuntime:    at androidx.compose.runtime.CompositionImpl.applyChanges(Composition.kt:1005)
06-16 11:18:53.028  6274  6274 E AndroidRuntime:    at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.kt:639)
06-16 11:18:53.028  6274  6274 E AndroidRuntime:    at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.kt:551)
06-16 11:18:53.028  6274  6274 E AndroidRuntime:    at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(AndroidUiFrameClock.android.kt:41)
06-16 11:18:53.028  6274  6274 E AndroidRuntime:    at androidx.compose.ui.platform.AndroidUiDispatcher.performFrameDispatch(AndroidUiDispatcher.android.kt:109)
06-16 11:18:53.028  6274  6274 E AndroidRuntime:    at androidx.compose.ui.platform.AndroidUiDispatcher.access$performFrameDispatch(AndroidUiDispatcher.android.kt:41)
06-16 11:18:53.028  6274  6274 E AndroidRuntime:    at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(AndroidUiDispatcher.android.kt:69)
06-16 11:18:53.028  6274  6274 E AndroidRuntime:    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1404)
06-16 11:18:53.028  6274  6274 E AndroidRuntime:    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1415)
06-16 11:18:53.028  6274  6274 E AndroidRuntime:    at android.view.Choreographer.doCallbacks(Choreographer.java:1015)
06-16 11:18:53.028  6274  6274 E AndroidRuntime:    at android.view.Choreographer.doFrame(Choreographer.java:941)
06-16 11:18:53.028  6274  6274 E AndroidRuntime:    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1389)
06-16 11:18:53.028  6274  6274 E AndroidRuntime:    at android.os.Handler.handleCallback(Handler.java:959)
06-16 11:18:53.028  6274  6274 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:100)
06-16 11:18:53.028  6274  6274 E AndroidRuntime:    at android.os.Looper.loopOnce(Looper.java:232)
06-16 11:18:53.028  6274  6274 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:317)
06-16 11:18:53.028  6274  6274 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:8674)
06-16 11:18:53.028  6274  6274 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
06-16 11:18:53.028  6274  6274 E AndroidRuntime:    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
06-16 11:18:53.028  6274  6274 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:886)
06-16 11:18:53.028  6274  6274 E AndroidRuntime:    Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [androidx.compose.runtime.PausableMonotonicFrameClock@6db091f, androidx.compose.ui.platform.MotionDurationScaleImpl@504846c, StandaloneCoroutine{Cancelling}@acd7a35, AndroidUiDispatcher@eb75eca]

amplifyconfiguration.json

No response

Additional information and screenshots

Base on Android document about this problem , it seems the lib has to rebuild again to work on 16KB devices.

Beginning with Android 15, Android supports devices that are configured to use a page size of 16 KB (16 KB devices). 
If your app uses any [NDK](https://developer.android.com/ndk) libraries, either directly or indirectly through an SDK, 
then you will need to rebuild your app for it to work on these 16 KB devices.
vincetran commented 3 months ago

Thanks @vegeta2102 for the report and early Android 15 testing! Someone will take a look at this issue as soon as possible.

tylerjroach commented 3 months ago

Hi @vegeta2102, I've taken steps to attempt to support Android 15 devices with a 16kb page size. I was able to upgrade our own native lib.

However, we also make use of tensorflow-light, which has not received 16kb page support yet. We are currently blocked until TensorFlow updates their own library to support 16kb page sizes. Tracking here: https://github.com/tensorflow/tensorflow/issues/69459

We will keep a close eye on progress made on their end and update Liveness support when possible.

vegeta2102 commented 3 months ago

@tylerjroach Thank you very much !!! It seems TensorFlow also has the PR for updating 16KB support . When will you release amplify-ui-android for supporting 16KB ?

tylerjroach commented 3 months ago

I can't give a specific date as were still waiting for TensorFlow release, but we will try to release our update shortly after to ensure no customer impact.

vegeta2102 commented 3 months ago

@tylerjroach I got it. Let's wait for the TensorFlow release.

vegeta2102 commented 1 month ago

@tylerjroach

https://github.com/tensorflow/tensorflow/issues/69459#issuecomment-2323607507 I checked that so pls do the next step