In the previous post, I showed you how to import OpenCV Android Tutorial 2 sample app into Android Studio and build with NDK integration, which admittedly was quite complicated. I am happy to present much easier method here in terms of NDK integration, starting from Android Studio 2.2.
The only difference from the past post lies in the App module's build.gradle file. The new file should resemble this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "24.0.3"
defaultConfig {
applicationId "org.opencv.samples.tutorial2"
minSdkVersion 8
targetSdkVersion 22
ndk {
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
externalNativeBuild {
ndkBuild {
path 'src/main/jni/Android.mk'
}
}
}
dependencies {
compile project(':openCVLibrary310')
}
That's it! This will now let Android Studio successfully load C/C++ source files in the src/main/jni directory with valid syntax correction, etc.
No comments:
Post a Comment