报错如上
本人Android小白,没有c++/c的经验,最近需要搞一个车牌识别的app,用的是开源的hyperlpr项目,搞完其他的东西后,然后导入好cmake开始调试时,一直报这个错
我引入过其他的.so文件比如
'x86', 'x86_64', 'mips', 'mips64',但是说报错都找不到对应文件
我的build.gradle如下
apply plugin: 'com.android.application'
android {
compileSdkVersion 30
buildToolsVersion '30.0.3'
defaultConfig {
applicationId "com.example.test21"
minSdkVersion 25
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags "-std=c++11"
// cppFlags "-std=c++11 -frtti -fexceptions"
// abiFilters 'armeabi-v7a'
arguments '-DANDROID_STL=gnustl_static'
// arguments '-DANDROID_STL=gnustl_shared'
// '-DANDROID_ABI=armeabi-v7a'
}
}
ndk {
//选择要添加的对应 cpu 类型的 .so 库。
abiFilters 'armeabi-v7a'
// 还可以添加 'x86', 'x86_64', 'mips', 'mips64'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
sourceSets.main {
jni.srcDirs = [] // This prevents the auto generation of Android.mk
jniLibs.srcDirs = ['libs','src/main/cpp/opencv342/sdk/native/libs']
//jniLibs.srcDirs =['src/main/libs','src/main/jniLibs']
}
externalNativeBuild {
cmake {
path 'src/main/cpp/CMakeLists.txt'
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation project(path:':openCVLibrary346')
}
目前我使用的是ndk16,我试过升级nkd版本,但是没有用,求求大佬们指点一下
我的cmake如下
message(STATUS "OpenCV libraries: ${OpenCV_LIBS}")
#include_directories(/Users/mac02/Desktop/studiospace/test/PrjAnndroid/app/src/main/cpp/include)
#set(pathToOpenCv /Users/mac02/Downloads/OpenCV-android)
#配置加载native依赖
#include_directories(${pathToOpenCv}/sdk/native/jni/include)
#动态方式加载
#add_library( lib_opencv SHARED IMPORTED )
#引入libopencv_java3.so文件
#set_target_properties(lib_opencv PROPERTIES IMPORTED_LOCATION /Users/mac02/Desktop/studiospace/test/PrjAnndroid/app/src/main/jniLibs/armeabi-v7a/libopencv_java3.so)
aux_source_directory(. SOURCES1)
aux_source_directory(./src SOURCES2)
list (APPEND SOURCES
${SOURCES1}
${SOURCES2}
)
message(STATUS "My sources: ${SOURCES}")
add_library( # Sets the name of the library.
hyperlpr
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
${SOURCES})
#target_link_libraries( hyperlpr lib_opencv)
target_link_libraries(hyperlpr jnigraphics ${OpenCV_LIBS})
#连接现成的第三方库
#set(INC_DIR /Users/mac02/Desktop/studiospace/test/PrjAnndroid/app/src/main/cpp/OpencvNative/include)
#set(LINK_DIR /Users/mac02/Desktop/studiospace/test/PrjAnndroid/app/src/main/cpp/OpencvNative/libs)
#include_directories(OpencvNative/jni/include)
#include_directories(${INC_DIR}) # 用${}引用变量
#link_directories(${LINK_DIR})
#aux_source_directory(./include SOURCES1)
#aux_source_directory(./src SOURCES2)
#list (APPEND SOURCES
# ${SOURCES1}
# ${SOURCES2}
# javaWarpper.cpp
#)
#add_library( # Sets the name of the library.
# hyperlpr
# # Sets the library as a shared library.
# SHARED
# Provides a relative path to your source file(s).
# ${SOURCES})