Ask Your Question
0

Trouble setting up OpenCV with NDK in Android Studio

asked 2016-08-09 00:29:12 -0500

Pulkit gravatar image

updated 2016-08-09 00:32:29 -0500

Hi, I would like to use OpenCV with the NDK in my Android Project. I am using Android Studio. I can't get it to compile properly. I am getting error while including opencv2 in my cpp file..... **

I followed all the steps. i copied all the native libs to my jniLibs

C:\fakepath\Capture1.PNG

My gradle looks like this

C:\fakepath\gradle.PNG

THIS IS MY Android.mk file

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

OPENCV_CAMERA_MODULES:=on

OPENCV_INSTALL_MODULES:=on

 #OPENCV_LIB_TYPE:=STATIC

include F:/PULKIT/Resources/Android OpenCV/OpenCV-2.4.11-android-sdk/OpenCV-android-sdk/sdk/native/jni/OpenCV.mk

LOCALE_MODULE := ndkLib
LOCAL_SRC_FILES := helloJNI.cpp

LOCAL_C_INCLUDES += F:/PULKIT/Resources/Android OpenCV/OpenCV-2.4.11-android-sdk/OpenCV-android-sdk/sdk/native/jni/include

LOCAL_LDLIBS +=  -llog -ldl

include $(BUILD_SHARED_LIBRARIES)

This is my Application.mk file

APP_STL := gnustl_static

APP_CPPFLAGS := -frtti -fexceptions

APP_ABI := armeabi-v7a

APP_PLATFORM := android-17

ERROR i am getting is

C:\fakepath\Capture.PNG

edit retag flag offensive close merge delete

Comments

did you figure it out?

cellurl gravatar imagecellurl ( 2016-09-03 00:47:32 -0500 )edit

did you figure it out? I also am compiling from github to android-studio

cellurl gravatar imagecellurl ( 2016-09-03 00:48:14 -0500 )edit

@cellurl, please stop posting answers, if you have a comment or question.

berak gravatar imageberak ( 2016-09-03 01:23:09 -0500 )edit

2 answers

Sort by ยป oldest newest most voted
0

answered 2017-05-17 10:20:25 -0500

sengsational gravatar image

There is a similar question here with code on github.

There is a feature of Android Studio to Include C++ Support which generates an external build file called CMakeLists.txt. The similar question has changes required to that file to get the C++ portion of OpenCV to compile in Android Studio.

edit flag offensive delete link more
0

answered 2016-09-22 19:43:45 -0500

dtdzung gravatar image

this videos exactly match what you need about configuration opencv. ndk and android studio https://www.youtube.com/watch?v=Oq3oi...

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-08-09 00:29:12 -0500

Seen: 1,094 times

Last updated: May 17 '17