Я обнаружил, что, возможно, проблема со стандартной библиотекой ... Но я не знаю, как изменить это с помощью Cmake.Я перепробовал много вариантов, но он не работает.
Мой build.gradle :
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.test"
minSdkVersion 21
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags "-frtti -fexceptions"
abiFilters "armeabi-v7a"
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path "src/main/cpp/CMakeLists.txt"
}
}
sourceSets { main { jni.srcDirs = ['src/main/cpp', 'src/main/jniLib/'] } }
}
dependencies {
implementation project(':openCVLibrary2411')
}
, а мой CMAkeList.txt выглядит следующим образом:
cmake_minimum_required(VERSION 3.4.1)
#set(ANDROID_STL "c++_shared")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# OpenCV IMPORT
include_directories(C:/OpenCV-android-sdk_2_4_11/sdk/native/jni/include)
add_library( lib-opencv SHARED IMPORTED )
set_target_properties(lib-opencv PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/../jniLibs/${ANDROID_ABI}/libopencv_java.so)
add_library( # Sets the name of the library.
native-lib
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
native-lib.cpp
main.cpp
)
find_library( # Sets the name of the path variable.
log-lib
# Specifies the name of the NDK library that
# you want CMake to locate.
log )
target_link_libraries( # Specifies the target library.
native-lib
# Links the target library to the log library
# included in the NDK.
${log-lib} )
Я проверил эту ссылку , но для ndk-build ... Но я работаю с cmake (Android Studio 3 +)