RedApparat / Fotoapparat

Making Camera for Android more friendly. 📸
Apache License 2.0
3.82k stars 405 forks source link

Take picture, nothing happens #230

Closed BorisLeMeec closed 6 years ago

BorisLeMeec commented 6 years ago

What are you trying to achieve or the steps to reproduce?

Hi, when I try to take a picture with Fotoapparat, nothing happens.

fun seeAccount(view: View) {
        Log.e("photo", "take")
        val photoResult = fotoapparat.takePicture()
        val byteArrayOutputStream = ByteArrayOutputStream()

        photoResult.toBitmap().whenAvailable { result ->
            Log.i("photo", result.toString())
    }

How did you initialize FA?

In a good way i think because I am able to see preview in CameraView

What was the result you received?

"photo : take" Then Nothing

What did you expect?

Something like "Photo : take Photo : xxxxx"

Context:

Diolor commented 6 years ago

Probably something fails in the camera hardware. Check here this issue over how to debug it https://github.com/Fotoapparat/Fotoapparat/issues/207#issuecomment-366794981

cyberrob-zz commented 5 years ago

In my case it's due to invalid file path. After fixing the path issue, camera works as before.

covenant3717 commented 3 years ago

What are you trying to achieve or the steps to reproduce?

Hi, when I try to take a picture with Fotoapparat, nothing happens.

fun seeAccount(view: View) {
        Log.e("photo", "take")
        val photoResult = fotoapparat.takePicture()
        val byteArrayOutputStream = ByteArrayOutputStream()

        photoResult.toBitmap().whenAvailable { result ->
            Log.i("photo", result.toString())
    }

How did you initialize FA?

In a good way i think because I am able to see preview in CameraView

What was the result you received?

"photo : take" Then Nothing

What did you expect?

Something like "Photo : take Photo : xxxxx"

Context:

    • FA version 2.2.0:
  • Xiaomi Mi Mix:

Through experimentation, I found out that the problem is precisely in "toBitmap". On my device, converting to Bitmap was throwing "java.lang.OutOfMemoryError: Failed to allocate a 63701004 byte allocation with 16777216 free bytes and 42MB until OOM". After adding (android: largeHeap = "true") to Manifest in <application ... /> - "toBitmap" started working