Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Camera 2 API - won't take picture

i have a problem with Camera 2 API in Android. I'm using native android with Android Studio. The camera is okay on TextureView but when i'm trying to take a pict. It doesn't work. I followed teh Kotlin Basic Example in the official github page of Camera 2 API. I saw the Logcat when i opened the Camera Activity :

2018-11-14 09:37:59.963 4009-4009/sayurbox.com.oms E/libc: Access denied finding property "persist.camera.privapp.list"
2018-11-14 09:37:59.965 4009-4958/sayurbox.com.oms E/libc: Access denied finding property "camera.hal1.packagelist"
2018-11-14 09:38:00.166 4009-5002/sayurbox.com.oms E/libc: Access denied finding property "persist.camera.legacy_perf"
2018-11-14 09:38:01.971 4009-4957/sayurbox.com.oms E/RequestQueue: cancel failed: no repeating request exists.
like image 841
Galih laras prakoso Avatar asked Oct 23 '25 04:10

Galih laras prakoso


1 Answers

I don't know about the exact scenario of yours but in most cases, this happens if not running in the right thread. For example, just running mediaRecorder.start() will cause a similar error but putting media recorder to run on UI thread solves this issue.

runOnUiThread(
        new Runnable() {
        @Override
        public void run() {
            mediaRecorder.start();
        }
});

But as I said this is once scenario, and there could be other scenarios also for the issue.

Hopefully it will help someone.

like image 50
Abhishek Dwivedi Avatar answered Oct 24 '25 17:10

Abhishek Dwivedi