Unable to create OpenCV Objects

asked 2017-11-12 10:08:50 -0500

I am using Android Studio 3.0 and Gradle 3.0.0 and OpenCV 3.3.1. Followed the below steps:- 1.Imported OpenCv module (selecting the java folder within the OpenCV android sdk) 2.Added OpenCVLibrary331 as module dependency 3.Synced the build.gradle(app) with build.gradle(OpenCV) for the parameters:- compileSdkVersion 25 buildToolsVersion '26.0.2' minSdkVersion 15 targetSdkVersion 25

4.Copied the contents of libs folder of OpenCV android sdk/native under app/src/main/jniLibs of the android project

5.Installed npm 6.Copy pasted the Android.mk auto generated from the build from app/build/intermediates/ndk to under app/Android.mk such that it is in the same level of build.gradle(module level) 7.In the build.gradle(module) have included the ndk block The project build without any error however unable to create any of the Open CV object.Any guidance to solve this issue?? apply plugin: 'com.android.application'

android { compileSdkVersion 25 buildToolsVersion '26.0.2' defaultConfig { applicationId "com.example.ibm.myapplication" minSdkVersion 15 targetSdkVersion 25 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" //added from saikat // sourceSets.main { // jniLibs.srcDir 'src/main/jnilibs' // jni.srcDirs = [] //disable automatic ndk-build call // } } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } sourceSets { main { jni.srcDirs = ['src/main/jni', 'src/main/jniLibs/'] } } externalNativeBuild { // Encapsulates your CMake build configurations. // For ndk-build, instead use the ndkBuild block. ndkBuild { // Specifies a path to your CMake build script that's // relative to the build.gradle file. path "Android.mk" } }


dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) compile 'com.android.support:appcompat-v7:25.3.1' compile 'com.android.support.constraint:constraint-layout:1.0.2' testCompile 'junit:junit:4.12' compile project(':openCVLibrary331')

edit retag flag offensive close merge delete