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

Android emulator issue on Kotlin version of Vision-QuickStart #20

Closed
michaelcarrano opened this issue Jun 18, 2020 · 3 comments · Fixed by #21
Closed

Android emulator issue on Kotlin version of Vision-QuickStart #20

michaelcarrano opened this issue Jun 18, 2020 · 3 comments · Fixed by #21

Comments

@michaelcarrano
Copy link
Contributor

I have been playing around with these samples using an Emulator on API 29 (Pixel 2).

I noticed with the https://github.com/googlesamples/mlkit/tree/master/android/vision-quickstart

The Java version works fine without issues, however, the Kotlin version I run into issues.

On the Kotlin version, I am unable to move the emulator camera around and it does not seem to be detecting any objects. In the video below, you'll notice the message below the emulator keeps showing/dismissing non-stop.

Here's a video: https://youtu.be/jzaUEeOZT2Q

This is reproducible by myself and others on my team.

Let me know if there is any other information needed.

@michaelcarrano
Copy link
Contributor Author

Had some free time this morning to look into this issue and I think I found it. I can open a PR if you'd like, otherwise the fix is pretty straight forward.

The issue lie within the bindPreviewUseCase() method on CameraXLivePreviewActivity.

Java - https://github.com/googlesamples/mlkit/blob/master/android/vision-quickstart/app/src/main/java/com/google/mlkit/vision/demo/CameraXLivePreviewActivity.java#L296-L310
Kotlin - https://github.com/googlesamples/mlkit/blob/master/android/vision-quickstart/app/src/main/java/com/google/mlkit/vision/demo/kotlin/CameraXLivePreviewActivity.kt#L266-L280

You'll notice the methods are not identical.

Main difference is that in the Kotlin version, we are binding the cameraProvider lifecycle before we set the previewUseCase surface.

Making this change locally, the emulator is behaving as expected in the Kotlin sample.

@sheepmaster
Copy link
Collaborator

Thanks for the report! Yes, please open a pull request with the fix if you already have one.

@michaelcarrano
Copy link
Contributor Author

@sheepmaster done, submitted the PR.

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