Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration of Azure AI Vision SDK in Android Flutter #119

Open
thewebdepotteam opened this issue Sep 18, 2024 · 5 comments
Open

Integration of Azure AI Vision SDK in Android Flutter #119

thewebdepotteam opened this issue Sep 18, 2024 · 5 comments

Comments

@thewebdepotteam
Copy link

thewebdepotteam commented Sep 18, 2024

Uploading azureapp.png…

Please provide us with the following information:

This issue is for a: (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

I encountered an issue while trying to compile my Android Application.I received a build failure related to the inability to resolve some dependencies.

Any log messages given by the failure

`FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:checkInternalDebugAarMetadata'.

Could not resolve all files for configuration ':app:internalDebugRuntimeClasspath'.
Could not resolve com.azure.ai:azure-ai-vision-common:0.17.1-beta.1.
Required by:
project :app > project :liveness_azure_flutter
> Could not resolve com.azure.ai:azure-ai-vision-common:0.17.1-beta.1.
> Could not get resource 'https://jitpack.io/com/azure/ai/azure-ai-vision-common/0.17.1-beta.1/azure-ai-vision-common-0.17.1-beta.1.pom'.
> Could not HEAD 'https://jitpack.io/com/azure/ai/azure-ai-vision-common/0.17.1-beta.1/azure-ai-vision-common-0.17.1-beta.1.pom'. Received status code 401 from server: Unauthorized
Could not resolve com.azure.ai:azure-ai-vision-faceanalyzer:0.17.1-beta.1.
Required by:
project :app > project :liveness_azure_flutter
> Could not resolve com.azure.ai:azure-ai-vision-faceanalyzer:0.17.1-beta.1.
> Could not get resource 'https://jitpack.io/com/azure/ai/azure-ai-vision-faceanalyzer/0.17.1-beta.1/azure-ai-vision-faceanalyzer-0.17.1-beta.1.pom'.
> Could not HEAD 'https://jitpack.io/com/azure/ai/azure-ai-vision-faceanalyzer/0.17.1-beta.1/azure-ai-vision-faceanalyzer-0.17.1-beta.1.pom'. Received status code 401 from server: Unauthorized`

Expected/desired behavior

Integration of azure-ai-vision sdk so I can Detect Liveness in faces in my android application

OS and Version?

MacOs Sonoma 14.5

Versions

Mention any other details that might be useful


Thanks! We'll be in touch soon.

@diljale
Copy link
Contributor

diljale commented Sep 19, 2024

Hi,
You need to update the build.gradle to fetch the artifacts from our URL as depicted in build.gradle file. It seems you are trying to fetch the artifacts from https"//jitpack.io" which is expected to fail since the artifacts are hosted on https://pkgs.dev.azure.com/msface/SDK/_packaging/AzureAIVision/maven/v1

Please follow this build.gradle to setup correct maven repo and password
https://github.com/Azure-Samples/azure-ai-vision-sdk/blob/b47ca6f4a95455724ca10d0940debccd92912bb0/samples/kotlin/face/FaceAnalyzerSample/build.gradle#L22C18-L22C89

@thewebdepotteam
Copy link
Author

Thanks for the update the code is compiling as per suggestion, but after integrating in our flutter project when we try to start liveness check our app crashes Please find the log below of the crash and guide us how to resolve the same.

W/survey.training(19486): Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (unsupported, reflection, allowed) D/CompatibilityChangeReporter(19486): Compat change id reported: 210923482; UID 10595; state: ENABLED I/flutter (19486): liveness result: Error I/survey.training(19486): Compiler allocated 4271KB to compile void android.widget.TextView.<init>(android.content.Context, android.util.AttributeSet, int, int) I/CameraManagerGlobal(19486): Connecting to camera service D/CameraExtStub(19486): init android.hardware.camera2.impl.CameraExtImplXiaoMi D/CameraInjector(19486): waitForResult: D/CameraInjector(19486): updateCloudCameraControllerInfoAsync: E D/CameraInjector(19486): updateCloudCameraControllerInfoAsync: X W/CameraExtImplXiaoMi(19486): ignore the status update of camera: 2 D/CameraInjector(19486): updateCloudCameraControllerInfoAsync: has aleardy start update task. D/CameraInjector(19486): waitForResult: W/CameraExtImplXiaoMi(19486): ignore the status update of camera: 3 D/CameraInjector(19486): updateCloudCameraControllerInfoAsync: has aleardy start update task. D/CameraInjector(19486): waitForResult: W/CameraExtImplXiaoMi(19486): ignore the status update of camera: 4 D/CameraInjector(19486): updateCloudCameraControllerInfoAsync: has aleardy start update task. D/CameraInjector(19486): waitForResult: W/survey.training(19486): Long monitor contention with owner main (19486) at java.lang.String[] android.hardware.camera2.CameraManager$CameraManagerGlobal.getCameraIdList()(CameraManager.java:2206) waiters=0 in java.lang.String[] android.hardware.camera2.CameraManager$CameraManagerGlobal.getCameraIdList() for 122ms D/CameraInjector(19486): updateCloudCameraControllerInfoAsync: has aleardy start update task. D/CameraInjector(19486): waitForResult: D/CameraInjector(19486): updateCloudCameraControllerInfoAsync: has aleardy start update task. D/CameraInjector(19486): waitForResult: W/CameraManagerGlobal(19486): ignore the torch status update of camera: 2 D/CameraInjector(19486): updateCloudCameraControllerInfoAsync: has aleardy start update task. D/CameraInjector(19486): waitForResult: W/CameraManagerGlobal(19486): ignore the torch status update of camera: 3 D/CameraInjector(19486): updateCloudCameraControllerInfoAsync: has aleardy start update task. D/CameraInjector(19486): waitForResult: W/CameraManagerGlobal(19486): ignore the torch status update of camera: 4 I/FACE_TELEMETRY(19486): INFO_SUPPORTED_HARDWARE_LEVEL:3 D/CameraRepository(19486): Added camera: 0 I/Camera2CameraInfo(19486): Device Level: INFO_SUPPORTED_HARDWARE_LEVEL_3 D/CameraRepository(19486): Added camera: 1 I/Camera2CameraInfo(19486): Device Level: INFO_SUPPORTED_HARDWARE_LEVEL_3 D/CameraValidator(19486): Verifying camera lens facing on xagain, lensFacingInteger: null W/System.err(19486): java.lang.NoSuchMethodError: no non-static method "Lcom/azure/ai/vision/common/internal/implementation/IntRef;.setValue(J)V" W/System.err(19486): at com.azure.ai.vision.common.internal.implementation.PropertiesJNI.corePropertiesCreateHandle(Native Method) W/System.err(19486): at com.azure.ai.vision.common.internal.implementation.PropertiesJNI.createPropertiesHandle(PropertiesJNI.java:28) W/System.err(19486): at com.azure.android.ai.vision.common.FrameFormat.createFourCCFormat(FrameFormat.java:55) W/System.err(19486): at com.azure.android.ai.vision.common.FrameFormat.createRGBFormat(FrameFormat.java:80) W/System.err(19486): at com.azure.android.ai.vision.common.CameraXSourceInternal.<init>(CameraXSourceInternal.kt:151) W/System.err(19486): at com.azure.android.ai.vision.common.AndroidCamera$Companion.create(AndroidCamera.kt:128) W/System.err(19486): at com.azure.android.ai.vision.common.VisionSource.fromDefaultCamera(VisionSource.java:287) W/System.err(19486): at biz.godrejcp.survey.AnalyzeActivity.onResume(AnalyzeActivity.kt:105) W/System.err(19486): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1617) W/System.err(19486): at android.app.Activity.performResume(Activity.java:9045) W/System.err(19486): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:5250) W/System.err(19486): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:5294) W/System.err(19486): at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:57) W/System.err(19486): at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45) W/System.err(19486): at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:190) W/System.err(19486): at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:101) W/System.err(19486): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2616) W/System.err(19486): at android.os.Handler.dispatchMessage(Handler.java:106) W/System.err(19486): at android.os.Looper.loopOnce(Looper.java:222) W/System.err(19486): at android.os.Looper.loop(Looper.java:314) W/System.err(19486): at android.app.ActivityThread.main(ActivityThread.java:8716) W/System.err(19486): at java.lang.reflect.Method.invoke(Native Method) W/System.err(19486): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:565) W/System.err(19486): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081) W/System.err(19486): java.lang.NoSuchMethodError: no non-static method "Lcom/azure/ai/vision/common/internal/implementation/IntRef;.setValue(J)V" W/System.err(19486): at com.azure.ai.vision.common.internal.implementation.PropertiesJNI.corePropertiesCreateHandle(Native Method) W/System.err(19486): at com.azure.ai.vision.common.internal.implementation.PropertiesJNI.createPropertiesHandle(PropertiesJNI.java:28) W/System.err(19486): at com.azure.android.ai.vision.faceanalyzer.FaceAnalyzerCreateOptions.<init>(FaceAnalyzerCreateOptions.java:22) W/System.err(19486): at biz.godrejcp.survey.AnalyzeActivity.createFaceAnalyzer(AnalyzeActivity.kt:145) W/System.err(19486): at biz.godrejcp.survey.AnalyzeActivity.onResume(AnalyzeActivity.kt:109) W/System.err(19486): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1617) W/System.err(19486): at android.app.Activity.performResume(Activity.java:9045) W/System.err(19486): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:5250) W/System.err(19486): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:5294) W/System.err(19486): at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:57) W/System.err(19486): at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45) W/System.err(19486): at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:190) W/System.err(19486): at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:101) W/System.err(19486): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2616) W/System.err(19486): at android.os.Handler.dispatchMessage(Handler.java:106) W/System.err(19486): at android.os.Looper.loopOnce(Looper.java:222) W/System.err(19486): at android.os.Looper.loop(Looper.java:314) W/System.err(19486): at android.app.ActivityThread.main(ActivityThread.java:8716) W/System.err(19486): at java.lang.reflect.Method.invoke(Native Method) W/System.err(19486): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:565) W/System.err(19486): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081) D/AndroidRuntime(19486): Shutting down VM E/AndroidRuntime(19486): FATAL EXCEPTION: main

@diljale
Copy link
Contributor

diljale commented Sep 23, 2024

Can you please confirm if you are able to run the sample successfully ? If so, can you confirm that you are using the same dependencies as specified in the sample and you see camera turn on before the crash ?

@thewebdepotteam
Copy link
Author

We tried the sample and it ran successfully, we added our endpoint and key and clicked on Liveness button and then the start button we get the following error

Results Error : Missing or incorrect settings

and then when we click on retry we get a white screen with a black circle (screenshot attached)

The Phone we are using is on Android 11

face-error-01
face-error-02

Please help in resolving the issue

@diljale
Copy link
Contributor

diljale commented Sep 24, 2024

Can you make sure the endpoint and key are from the same subscription that has access to FaceLiveness ? Also please make sure there are no trailing slashes at the end of URL for the sample.

This error is for cases where Token generation is failing. It would be good if you can look at Network calls and see why call the /.../sessions is failing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants