Preview display skewed
Sometimes the preview presents a skewed image, as if you were elongating the image. Here's the most consistent way I can reproduce this:
- Start the app with phone in portrait mode. Preview may or may not be fine. If it is fine:
- Rotate the phone to landscape. Preview should stay fine.
- Rotate back to portrait. Now the preview should be weird and skewed.
I know that's a confusing description, hopefully you can reproduce it. I'm guessing it has to do with the configureTransform method?
I have the same exactly problem using front camera. When you enter the app image is weirdly stretched. If you exit and reenter the app then camera just works fine.
What device are you using?
I am using a Sony Xperia Z1. I was also forced to comment code for autofocus because the app was crushing. I was trying to understand what was different in onStop() and onResume() methods but I didn't worked it out.
I'm using a HTC One m7 running CyanogenMod 12.0.
On Tue, Jun 16, 2015, 4:55 AM Yuichi Araki [email protected] wrote:
What device are you using?
— Reply to this email directly or view it on GitHub https://github.com/googlesamples/android-Camera2Basic/issues/9#issuecomment-112345895 .
I am using Moto G (XT1033). The preview is skewed as shown below with the start of the activity. On resuming the activity, the preview turns back to normal.

Hey guys, do you fix the problem ? I got the same problem. When the preview is skewed, I just turned the screen off and turn back on again and the preview is fine now.
Same here. It also gives me an error "E/BufferQueueProducer﹕ [unnamed-26081-14] dequeueBuffer: min undequeued buffer count (2) exceeded (dequeued=6 undequeued=1)" followed by "E/BufferQueueProducer﹕ [unnamed-26081-14] dequeueBuffer: BufferQueue has been abandoned"
Any idea how to fix this?
Had the same problem. Fixed by hiding the bars ontop.
Bars on top? You meant the action bar?
Yea the Bar that says Camera2 with the back button and the bar with the battery and all that.
Anyone found a solution for the preview distortion problem?
Any solution for this issue ??
For anyone struggling with this issue check my workaround at https://stackoverflow.com/a/48138680/937678
Any working solutions for this issue?
I had the same issue with a LG Phone, solved it setting this on my TextureView Layout:
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@GuanacoDevs thanks but that didn't help..
I am also having this problem with my Galaxy Tab A 10.1" - 1920x1200 is the original solution. TextureView Ratio and size is set to 1920:1080 because I need 16:9 pictures and because the camera has no full screen functionality. The delay before opening also does not help.
Any other ideas @PoloShock ?
@damaro333 if the delay didn't help, I have no other thoughts, sorry. :(
@PoloShock I was able to solve this issue with setting the ratio to 4:3. I did not have the problem with few 16:9 mobiles like the Galaxy J5, with the Galaxy Note 8 which is 18,5x9 ...Only with the Galaxy Tab A 10.1...the display is 16:10 and it seems to be a hardware issue.
So no hard feelings about it, will try it in a few months.
This sample has been migrated to a new location where we can accept Pull Requests (check README for more information).
As recommended by GitHub, we are closing all issues and pull requests now that this older repo will be archived.
If you still see this issue in the updated repo, please reopen the issue/PR there. Thank you!