Issue
I want develop opencv programs in android with NDK, for that I tried to build this sample project in android studio but when made project these errors occur :
Build command failed.
Error while executing process E:\SoftWare\Android\android-ndk-r19c\ndk-build.cmd with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=C:\Users\127051\Documents\StudioProjects\StudioProjects\ImageProccessing\app\src\main\cpp\Android.mk NDK_APPLICATION_MK=C:\Users\127051\Documents\StudioProjects\StudioProjects\ImageProccessing\app\src\main\cpp\Application.mk APP_ABI=x86_64 NDK_ALL_ABIS=x86_64 NDK_DEBUG=1 APP_PLATFORM=android-21 NDK_OUT=C:/Users/127051/Documents/StudioProjects/StudioProjects/ImageProccessing/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=C:\Users\127051\Documents\StudioProjects\StudioProjects\ImageProccessing\app\build\intermediates\ndkBuild\debug\lib APP_CPPFLAGS+=-std=c++14 C:/Users/127051/Documents/StudioProjects/StudioProjects/ImageProccessing/app/build/intermediates/ndkBuild/debug/obj/local/x86_64/libopencv_ndk.so}
[x86_64] Compile++ : opencv_ndk <= native-lib.cpp
In file included from C:/Users/127051/Documents/StudioProjects/StudioProjects/ImageProccessing/app/src/main/cpp/native-lib.cpp:4:
In file included from C:/Users/127051/Documents/StudioProjects/StudioProjects/ImageProccessing/app/src/main/cpp/CV_Main.h:15:
C:/Users/127051/Documents/StudioProjects/StudioProjects/ImageProccessing/app/src/main/cpp/Native_Camera.h:15:55: error: unknown type name 'ACameraDevice'
static void CameraDeviceOnDisconnected(void* context, ACameraDevice* device) {
^
C:/Users/127051/Documents/StudioProjects/StudioProjects/ImageProccessing/app/src/main/cpp/Native_Camera.h:18:48: error: unknown type name 'ACameraDevice'
static void CameraDeviceOnError(void* context, ACameraDevice* device,
^
C:/Users/127051/Documents/StudioProjects/StudioProjects/ImageProccessing/app/src/main/cpp/Native_Camera.h:25:35: error: unknown type name 'ACameraCaptureSession'
ACameraCaptureSession* session) {
^
C:/Users/127051/Documents/StudioProjects/StudioProjects/ImageProccessing/app/src/main/cpp/Native_Camera.h:29:36: error: unknown type name 'ACameraCaptureSession'
ACameraCaptureSession* session) {
^
C:/Users/127051/Documents/StudioProjects/StudioProjects/ImageProccessing/app/src/main/cpp/Native_Camera.h:52:3: error: unknown type name 'ACameraDevice'
ACameraDevice* m_camera_device;
^
C:/Users/127051/Documents/StudioProjects/StudioProjects/ImageProccessing/app/src/main/cpp/Native_Camera.h:53:3: error: unknown type name 'ACaptureRequest'
ACaptureRequest* m_capture_request;
^
C:/Users/127051/Documents/StudioProjects/StudioProjects/ImageProccessing/app/src/main/cpp/Native_Camera.h:54:3: error: unknown type name 'ACameraOutputTarget'
ACameraOutputTarget* m_camera_output_target;
^
C:/Users/127051/Documents/StudioProjects/StudioProjects/ImageProccessing/app/src/main/cpp/Native_Camera.h:55:3: error: unknown type name 'ACaptureSessionOutput'
ACaptureSessionOutput* m_session_output;
^
C:/Users/127051/Documents/StudioProjects/StudioProjects/ImageProccessing/app/src/main/cpp/Native_Camera.h:56:3: error: unknown type name 'ACaptureSessionOutputContainer'
ACaptureSessionOutputContainer* m_capture_session_output_container;
^
C:/Users/127051/Documents/StudioProjects/StudioProjects/ImageProccessing/app/src/main/cpp/Native_Camera.h:57:3: error: unknown type name 'ACameraCaptureSession'
ACameraCaptureSession* m_capture_session;
^
C:/Users/127051/Documents/StudioProjects/StudioProjects/ImageProccessing/app/src/main/cpp/Native_Camera.h:59:3: error: unknown type name 'ACameraDevice_StateCallbacks'
ACameraDevice_StateCallbacks m_device_state_callbacks;
^
C:/Users/127051/Documents/StudioProjects/StudioProjects/ImageProccessing/app/src/main/cpp/Native_Camera.h:60:3: error: unknown type name 'ACameraCaptureSession_stateCallbacks'
ACameraCaptureSession_stateCallbacks m_capture_session_state_callbacks;
^
C:/Users/127051/Documents/StudioProjects/StudioProjects/ImageProccessing/app/src/main/cpp/Native_Camera.h:62:3: error: unknown type name 'ACameraManager'
ACameraManager* m_camera_manager;
^
C:/Users/127051/Documents/StudioProjects/StudioProjects/ImageProccessing/app/src/main/cpp/Native_Camera.h:64:3: error: unknown type name 'ACameraIdList'
ACameraIdList* m_camera_id_list = NULL;
^
14 errors generated.
make: *** [C:/Users/127051/Documents/StudioProjects/StudioProjects/ImageProccessing/app/build/intermediates/ndkBuild/debug/obj/local/x86_64/objs-debug/opencv_ndk/native-lib.o] Error 1
Environment Details:
NDK Version: r19c
Host OS: Windows
IDE: Android Studio 3.3.2
SDK Platform Tools : 28.0.2
SDK Tools : 25.2.5
Solution
To use native camera2 API, set your APP_PLATFORM to android-24 or higher. In Android Studio, this corresponds to minSdkVersion in build.gradle
script.
Answered By - Alex Cohn
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.