Android Studio не видит JNI функции.
error:"Cannot resolve corresponding JNI function..."
build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.m.f"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags "-frtti -fexceptions"
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
sourceSets { main { jni.srcDirs = ['src/main/jni', 'src/main/jni/jniLibs'] } }
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation project(':openCVLibrary342dev')
}
Face.java
...
// C++: Ptr_Facemark cv::face::createFacemarkAAM()
private static native long createFacemarkAAM_0();
// C++: Ptr_Facemark cv::face::createFacemarkKazemi()
private static native long createFacemarkKazemi_0();
// C++: Ptr_Facemark cv::face::createFacemarkLBF()
private static native long createFacemarkLBF_0();
...
Определение функций находится в *.so файле.
Файл добавлен в папку jniLibs.