mitchtabian / TabianCustomCamera

Custom camera for android using camera2 api (DEPRECATED)
152 stars 66 forks source link

Crashes when capture picture using back camera and while previewing it. #11

Closed ibrar1988 closed 5 years ago

ibrar1988 commented 5 years ago

Issue I found:

  1. Sometimes unable to capture a picture using back camera. Even capture button not responding it seems like.
  2. If able to capture a picture using back camera , the app crashes while previewing that picture.

This is error I am seeing:

2019-02-14 17:04:51.037 10007-10687/codingwithmitch.com.tabiancustomcamera E/GlideExecutor: Request threw uncaught throwable com.bumptech.glide.Registry$NoModelLoaderAvailableException: Failed to find any ModelLoaders for model: android.media.ImageReader$SurfaceImage@969c821 at com.bumptech.glide.Registry.getModelLoaders(Registry.java:584) at com.bumptech.glide.load.engine.DecodeHelper.getLoadData(DecodeHelper.java:205) at com.bumptech.glide.load.engine.DecodeHelper.getCacheKeys(DecodeHelper.java:223) at com.bumptech.glide.load.engine.ResourceCacheGenerator.startNext(ResourceCacheGenerator.java:44) at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:302) at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:269) at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:233) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) at java.lang.Thread.run(Thread.java:760) at com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultThreadFactory$1.run(GlideExecutor.java:446)


2019-02-14 17:04:51.454 10007-10007/codingwithmitch.com.tabiancustomcamera W/Glide: Load failed for android.media.ImageReader$SurfaceImage@969c821 with size [720x1280] class com.bumptech.glide.load.engine.GlideException: Failed to load resource There was 1 cause: com.bumptech.glide.Registry$NoModelLoaderAvailableException(Failed to find any ModelLoaders for model: android.media.ImageReader$SurfaceImage@969c821) call GlideException#logRootCauses(String) for more detail Cause (1 of 1): class com.bumptech.glide.Registry$NoModelLoaderAvailableException: Failed to find any ModelLoaders for model: android.media.ImageReader$SurfaceImage@969c821

mitchtabian commented 5 years ago

Have you finished the course?

And have you compared your code with mine?

On Thu., Feb. 14, 2019, 3:34 a.m. Ibrar Hussain Ansari < notifications@github.com wrote:

Issue I found:

  1. Sometimes unable to capture a picture using back camera. Even capture button not responding it seems like.
  2. If able to capture a picture using back camera , the app crashes while previewing that picture.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mitchtabian/TabianCustomCamera/issues/11, or mute the thread https://github.com/notifications/unsubscribe-auth/AQo2UJIUw9VYWKfCUNkWD3AE9rYIsmfAks5vNUnIgaJpZM4a7Z2u .

ibrar1988 commented 5 years ago

Which course you are taking about? Sorry I didn't get this point.

Yes I compiled completely your repository code on my system. However I fixed the crash issue on my local system.

Thanks, Ibrar

On Thu, 14 Feb 2019, 10:25 pm Mitch Tabian <notifications@github.com wrote:

Have you finished the course?

And have you compared your code with mine?

On Thu., Feb. 14, 2019, 3:34 a.m. Ibrar Hussain Ansari < notifications@github.com wrote:

Issue I found:

  1. Sometimes unable to capture a picture using back camera. Even capture button not responding it seems like.
  2. If able to capture a picture using back camera , the app crashes while previewing that picture.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mitchtabian/TabianCustomCamera/issues/11, or mute the thread < https://github.com/notifications/unsubscribe-auth/AQo2UJIUw9VYWKfCUNkWD3AE9rYIsmfAks5vNUnIgaJpZM4a7Z2u

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mitchtabian/TabianCustomCamera/issues/11#issuecomment-463704249, or mute the thread https://github.com/notifications/unsubscribe-auth/AhGnfdkFydzYe3utTJt80DUWO97PZypqks5vNZUdgaJpZM4a7Z2u .

mitchtabian commented 5 years ago

There is a course that goes along with the code.

https://codingwithmitch.com/courses/android-custom-camera/

I think it probably didn't work for you because I think the master branch doesn't have to must up to date code.

If you run this branch it should all work: https://github.com/mitchtabian/TabianCustomCamera/tree/6.4_manually_focusing_the_camera_preview_end

On Thu., Feb. 14, 2019, 9:42 a.m. Ibrar Hussain Ansari < notifications@github.com wrote:

Which course you are taking about? Sorry I didn't get this point.

Yes I compiled completely your repository code on my system. However I fixed the crash issue on my local system.

Thanks, Ibrar

On Thu, 14 Feb 2019, 10:25 pm Mitch Tabian <notifications@github.com wrote:

Have you finished the course?

And have you compared your code with mine?

On Thu., Feb. 14, 2019, 3:34 a.m. Ibrar Hussain Ansari < notifications@github.com wrote:

Issue I found:

  1. Sometimes unable to capture a picture using back camera. Even capture button not responding it seems like.
  2. If able to capture a picture using back camera , the app crashes while previewing that picture.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mitchtabian/TabianCustomCamera/issues/11, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AQo2UJIUw9VYWKfCUNkWD3AE9rYIsmfAks5vNUnIgaJpZM4a7Z2u

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/mitchtabian/TabianCustomCamera/issues/11#issuecomment-463704249 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AhGnfdkFydzYe3utTJt80DUWO97PZypqks5vNZUdgaJpZM4a7Z2u

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mitchtabian/TabianCustomCamera/issues/11#issuecomment-463720927, or mute the thread https://github.com/notifications/unsubscribe-auth/AQo2UPgdlFxZvsDZfbQYL89r2tozx4w0ks5vNZ_4gaJpZM4a7Z2u .

ibrar1988 commented 5 years ago

There is a course that goes along with the code. https://codingwithmitch.com/courses/android-custom-camera/ I think it probably didn't work for you because I think the master branch doesn't have to must up to date code. If you run this branch it should all work: https://github.com/mitchtabian/TabianCustomCamera/tree/6.4_manually_focusing_the_camera_preview_end On Thu., Feb. 14, 2019, 9:42 a.m. Ibrar Hussain Ansari < notifications@github.com wrote: Which course you are taking about? Sorry I didn't get this point. Yes I compiled completely your repository code on my system. However I fixed the crash issue on my local system. Thanks, Ibrar On Thu, 14 Feb 2019, 10:25 pm Mitch Tabian @. wrote: > Have you finished the course? > > And have you compared your code with mine? > > On Thu., Feb. 14, 2019, 3:34 a.m. Ibrar Hussain Ansari < > @. wrote: > > > Issue I found: > > > > 1. Sometimes unable to capture a picture using back camera. Even > > capture button not responding it seems like. > > 2. If able to capture a picture using back camera , the app crashes > > while previewing that picture. > > > > — > > You are receiving this because you are subscribed to this thread. > > Reply to this email directly, view it on GitHub > > <#11>, or mute > > the thread > > < > https://github.com/notifications/unsubscribe-auth/AQo2UJIUw9VYWKfCUNkWD3AE9rYIsmfAks5vNUnIgaJpZM4a7Z2u > > > > . > > > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > < #11 (comment) >, > or mute the thread > < https://github.com/notifications/unsubscribe-auth/AhGnfdkFydzYe3utTJt80DUWO97PZypqks5vNZUdgaJpZM4a7Z2u > > . > — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#11 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AQo2UPgdlFxZvsDZfbQYL89r2tozx4w0ks5vNZ_4gaJpZM4a7Z2u .

Oh Ok. I never know that course before, I will go through that. I checked out the branch one you suggested and the app still crash at that point. And the issue is with Glide at the time of displaying preview using it on image view.

Error Log:


E/GlideExecutor: Request threw uncaught throwable com.bumptech.glide.Registry$NoModelLoaderAvailableException: Failed to find any ModelLoaders for model: android.media.ImageReader$SurfaceImage@bb4fde1 at com.bumptech.glide.Registry.getModelLoaders(Registry.java:584) at com.bumptech.glide.load.engine.DecodeHelper.getLoadData(DecodeHelper.java:205) at com.bumptech.glide.load.engine.DecodeHelper.getCacheKeys(DecodeHelper.java:223) at com.bumptech.glide.load.engine.ResourceCacheGenerator.startNext(ResourceCacheGenerator.java:44) at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:302) at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:269) at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:233) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) at java.lang.Thread.run(Thread.java:760) at com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultThreadFactory$1.run(GlideExecutor.java:446) D/Camera2Fragment: doInBackground: adjusting image for display... I/ExifInterface_JNI: Raw image not detected


As I told you I fixed it already on local system and working great.

Thanks for your hard effort.