# No NDK Camera support in prebuilt 4.9.0 binary for Android?

**URL:** https://forum.opencv.org/t/no-ndk-camera-support-in-prebuilt-4-9-0-binary-for-android/16600
**Category:** C++
**Tags:** ndk, android, videoio
**Created:** [February 25, 2024, 8:17pm UTC](https://forum.opencv.org/t/no-ndk-camera-support-in-prebuilt-4-9-0-binary-for-android/16600 "2024-02-25T20:17:25Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![DarkSoda](https://avatars.discourse-cdn.com/v4/letter/d/958977/32.png) [@DarkSoda](https://forum.opencv.org/u/DarkSoda)
#### Post date: [February 25, 2024, 8:17pm UTC](https://forum.opencv.org/t/no-ndk-camera-support-in-prebuilt-4-9-0-binary-for-android/16600/1 "2024-02-25T20:17:25Z")

</div>

I am trying to use OpenCV v4.9.0 for Android to open a camera in my Native C++ code, but got failure after trying different index and api combinations. When trying cv::CAP\_ANDROID, I got this error

> [WARN:0@0.002] global cap.cpp:344 open VIDEOIO(ANDROID\_NATIVE): backend is generally available but can’t be used to capture by index

Below is my code:

> cv::VideoCapture cap;  
> int index = 0; //also tried 1, 32 and 33. The device has a camera module and can see video0, video1, video32 and video33 under/dev  
> int api = cv::CAP\_ANDROID; //also tried cv::CAP\_V4L2 and cv::CAP\_ANY  
> cap.open(index, api);  
> if (!cap.isOpenend())  
> {  
> //handle errors  
> }

I downloaded OpenCV 4.9.0 for Android from [here](https://github.com/opencv/opencv/releases/download/4.9.0/opencv-4.9.0-android-sdk.zip) , and while looking at the output of cv::getBuildInformation() , I noticed this

> Video I/O:  
> MEDIANDK: YES  
> NDK Camera: NO

Could this be the cause of my issue? Is “NDK Camera NO” expected for the prebuilt libopencv\_java4.so in the release verion?

For my C++, I am using NDK 26.1.10909125

---

<div class="post-metadata">

### Author: ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)
#### Post date: [February 26, 2024, 7:31am UTC](https://forum.opencv.org/t/no-ndk-camera-support-in-prebuilt-4-9-0-binary-for-android/16600/2 "2024-02-26T07:31:17Z")

</div>

[crosspost](https://meta.stackoverflow.com/a/266159) and solution (build from source):

> <https://stackoverflow.com/questions/78054753/how-to-open-camera-with-cvvideocapture-in-android-native-c>

---

<div class="post-metadata">

### Author: ![DarkSoda](https://avatars.discourse-cdn.com/v4/letter/d/958977/32.png) [@DarkSoda](https://forum.opencv.org/u/DarkSoda)
#### Post date: [February 26, 2024, 11:02pm UTC](https://forum.opencv.org/t/no-ndk-camera-support-in-prebuilt-4-9-0-binary-for-android/16600/3 "2024-02-26T23:02:08Z")

</div>

The StackOverflow article you linked were actually my post over there. Someone suggested I open an issue with OpenCV github but I later on found out the prebuilt OpenCV shared library from official website indeed doesn’t have NDK Camera support. I can build one from source with NDK Camera support.
