我正在尝试在android studio中为我的multidex项目添加一些lib(.jar和.so).
当我只为项目添加几个罐子时一切正常.如果我添加越来越多的罐子(其他库)我收到此错误:
java.lang.UnsatisfiedLinkError:
dalvik.system.PathClassLoader[DexPathList[[zip file
"/data/app/com.test.digital.ocrtest-2/base.apk"],nativeLibraryDirectories=[/data/app/com.test.digital.ocrtest-2/lib/arm,
/data/app/com.test.digital.ocrtest-2/base.apk!/lib/armeabi-v7a,
/vendor/lib, /system/lib]]] couldn't find
"libScanovatePassportAndIDLSDK_CPP.so"
Run Code Online (Sandbox Code Playgroud)
任何想法我怎么能告诉编译器生成jar,所以在同一个dex?
java-native-interface android android-studio android-gradle-plugin
我正在尝试在android studio项目中使用opencv本机库。对于函数knnMatch的未定义引用,我得到一个错误。
我已将openCVLibrary添加到我的项目中,并成功使用了其他openCV功能。
更新:添加我的编译文件
我的应用程序build.gradle:
apply plugin: 'com.android.application'
//
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
//
defaultConfig {
minSdkVersion 21
targetSdkVersion 27
...
externalNativeBuild {
cmake {
arguments "-DANDROID_ARM_NEON=TRUE", "-DANDROID_TOOLCHAIN=clang" , "-DANDROID_STL=c++_static","-DCMAKE_BUILD_TYPE=Release", "-DANDROID_CPP_FEATURES=rtti exceptions"
cppFlags "-D__STDC_FORMAT_MACROS" , '-O3','-fopenmp','-fsigned-char', "-std=c++14", "-frtti", "-fexceptions", "-mfloat-abi=softfp", "-Wall"
}
ndk {
abiFilters 'arm64-v8a'
}
}
}
//
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
...
}
//
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
implementation project(':openCVLibrary340') //Module
}
Run Code Online (Sandbox Code Playgroud)
我的CMakeList.txt:
cmake_minimum_required(VERSION 3.4.1)
# …Run Code Online (Sandbox Code Playgroud)