我在我的代码中包括boost,cpprest和openssl,但它给我的错误像follow在android studio使用ndk我给了所有路径的目录和添加到程序它构建成功,但当我运行它时,它给我以下错误
Build command failed.
Error while executing process C:\Users\Dell\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {--build D:\Android studio project\CppAddLibrary\app\.externalNativeBuild\cmake\debug\armeabi-v7a --target native-lib}
ninja: error: '/armeabi-v7a/libboost_system.so', needed by '../../../../build/intermediates/cmake/debug/obj/armeabi-v7a/libnative-lib.so', missing and no known rule to make it
我的cmakelist.txt是
cmake_minimum_required(VERSION 3.4.1)
add_library(native-lib SHARED src/main/cpp/native-lib.cpp)
#---------------boost--------------------------
add_library (boost_system SHARED IMPORTED)
set_target_properties( boost_system PROPERTIES IMPORTED_LOCATION
${-DMY_BOOST_LIBS_DIR}/${ANDROID_ABI}/libboost_system.so
)
#--------------boost_crono---------------------------
add_library( boost_chrono SHARED IMPORTED)
set_target_properties(boost_chrono PROPERTIES IMPORTED_LOCATION
${DMY_BOOST_LIBS_DIR}/${ANDROID_ABI}/libboost_chrono.so
)
#----------openssl-------------------------------
add_library(ssl SHARED IMPORTED)
set_target_properties(ssl PROPERTIES IMPORTED_LOCATION
${DMY_OPENSSL_LIBS_DIR}/${ANDROID_ABI}/libssl.a
)
#--------------cpprest---------------------------
add_library( cpprestsdk SHARED IMPORTED)
set_target_properties(cpprestsdk PROPERTIES IMPORTED_LOCATION
${DMY_OPENSSL_LIBS_DIR}/${ANDROID_ABI}/libcpprest.a
)
#-----------------------------------------
include_directories( ${DMY_BOOST_INC_DIR}
)
include_directories( ${DMY_OPENSSL_INC_DIR}
)
include_directories( ${DMY_CPPRESTSDK_INC_DIR}
)
#-----------------------------------------
find_library (log-lib log)
#-----------------------------------------
target_link_libraries( # Specifies the target library.
native-lib
${log-lib}
boost_system
boost_chrono
openssl
cpprestsdk
)
apply plugin: 'com.android.application'
def my_boost_dir = local_props("boost.dir")
def my_boost_dir_libs = my_boost_dir + "libs\\llvm"
def my_boost_dir_inc = my_boost_dir + "/include"
def my_openssl_dir = local_props("openssl.dir")
def my_openssl_dir_libs = my_openssl_dir + "/Prebuilt/armv7-shared/lib"
def my_openssl_dir_inc = my_openssl_dir + "/Prebuilt/armv7-shared/include/openssl"
def my_cpprestsdk_dir = local_props("cpprestsdk.dir")
def my_cpprestsdk_dir_libs = my_cpprestsdk_dir + "/armeabi-v7a/lib"
def my_cpprestsdk_dir_inc = my_cpprestsdk_dir + "/include"
android{compileSdkVersion 28 defaultConfig{applicationId“com.example.dell.cppaddlibrary”minSdkVersion 27 targetSdkVersion 28 versionCode 1 versionName“1.0”testInstrumentationRunner“android.support.test.runner.androidjunitrunner”externalNativeBuild{cmake{cppFlags“”arguments“-dandroid_stl=c++_shared”
arguments '-DMY_BOOST_LIBS_DIR=' + my_boost_dir_libs
arguments '-DMY_BOOST_INC_DIR=' + my_boost_dir_inc
arguments '-DMY_OPENSSL_LIBS_DIR=' + my_openssl_dir_libs
arguments '-DMY_OPENSSL_INC_DIR=' + my_openssl_dir_inc
arguments '-DMY_OPENSSL_LIBS_DIR=' + my_cpprestsdk_dir_libs
arguments '-DMY_OPENSSL_INC_DIR=' + my_cpprestsdk_dir_inc
}
}
ndk {
abiFilters 'armeabi-v7a', 'x86', 'x86_64', 'arm64-v8a'
stl 'c++_shared'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
sourceSets {
main {
jniLibs.srcDirs = [
my_boost_dir_libs,
my_openssl_dir_libs,
my_cpprestsdk_dir_libs
]
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
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'
}
def local_props(key) { // reads ~ value from local.properties file
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def val = properties.getProperty(key, null)
if (val == null)
throw new GradleException("""\
cant find value '${key}' in file 'local.properties'. """)
return val
}
而local.properties是
ndk.dir=C\:\\Users\\Dell\\AppData\\Local\\Android\\Sdk\\ndk-bundle
boost.dir=C\:\\Users\\Dell\\AppData\\Local\\Android\\Sdk\\ndk-bundle\\boost
openssl.dir=D\:\\Android studio project\\CppAddLibrary\\app\\Prebuilt_OpenSSL
cpprestsdk.dir=D\:\\Android studio project\\CppAddLibrary\\app\\cpprestsdk
sdk.dir=C\:\\Users\\Dell\\AppData\\Local\\Android\\Sdk
请帮我解决这个问题
提前致谢
现在它向我显示错误
Build command failed.
Error while executing process C:\Users\Dell\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {--build D:\Android studio project\CppAddLibrary\app\.externalNativeBuild\cmake\debug\armeabi-v7a --target native-lib}
[1/1] Linking CXX shared library ..\..\..\..\build\intermediates\cmake\debug\obj\armeabi-v7a\libnative-lib.so
FAILED: cmd.exe /C "cd . && C:\Users\Dell\AppData\Local\Android\Sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=armv7-none-linux-androideabi27 --gcc-toolchain=C:/Users/Dell/AppData/Local/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64 --sysroot=C:/Users/Dell/AppData/Local/Android/Sdk/ndk-bundle/sysroot -fPIC -isystem C:/Users/Dell/AppData/Local/Android/Sdk/ndk-bundle/sysroot/usr/include/arm-linux-androideabi -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -mfpu=neon -Wa,--noexecstack -Wformat -Werror=format-security -std=c++11 -frtti -fexceptions -DBOOST_SYSTEM_NO_DEPRECATED -O0 -fno-limit-debug-info -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libatomic.a -nostdlib++ --sysroot C:/Users/Dell/AppData/Local/Android/Sdk/ndk-bundle/platforms/android-27/arch-arm -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--fix-cortex-a8 -Wl,--exclude-libs,libunwind.a -LC:/Users/Dell/AppData/Local/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a -Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now -shared -Wl,-soname,libnative-lib.so -o ..\..\..\..\build\intermediates\cmake\debug\obj\armeabi-v7a\libnative-lib.so CMakeFiles/native-lib.dir/src/main/cpp/native-lib.cpp.o -llog C:/Users/Dell/AppData/Local/Android/Sdk/ndk-bundle/boost/libs/llvm/armeabi-v7a/libboost_system.so C:/Users/Dell/AppData/Local/Android/Sdk/ndk-bundle/boost/libs/llvm/armeabi-v7a/libboost_chrono.so -lopenssl ../../../../cpprestsdk/lib/armeabi-v7a/libcpprest.a -latomic -lm "C:/Users/Dell/AppData/Local/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libunwind.a" "C:/Users/Dell/AppData/Local/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++_shared.so" && cd ."
C:/Users/Dell/AppData/Local/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin\ld: error: cannot find -lopenssl`enter code here`
set_target_properties( boost_system PROPERTIES IMPORTED_LOCATION
${-DMY_BOOST_LIBS_DIR}/${ANDROID_ABI}/libboost_system.so
)
${-dmy_boost_libs_dir}
应该是什么?这个变量的计算值为零,这就是为什么你得到了错误的路径。
在示例空手道测试项目中,我们有一个功能文件和一个runner类。 尝试使用下面的命令通过命令行执行测试 抛出以下错误... [信息]-------------------------------------------------------------[信息]生成失败[信息]-------------------------------------------------------------
错误:任务“:app:checkdebugaarmadata”的执行失败 发生多个任务操作失败:执行com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction时发生失败
我正在尝试在Ubuntu14.04 LTS上使用Python2.7构建tensorflow,没有GPU。当我在终端上运行本教程中的以下命令时: 它说无法使用日志进行构建: 这是我的构建环境: OS:Ubuntu14.04 LTS 64位内存12Gib gcc版本:4.8.4 python版本:2.7.6 bazel版本:0.3.2 git版本的tensorflow源代码:v0。11.0rc0-15
我试图运行ionic build Android--release命令来构建apk,但是我得到了这个错误 构建失败 总时间:2.623秒错误:cmd:命令失败,退出代码为1错误输出:失败:生成失败,出现异常。 错误:配置root项目'Android'时出现问题。您尚未接受以下SDK组件的许可协议:[Android SDK Platform25]。在构建项目之前,您需要接受许可协议,并使用Andro
命令: 我是不是漏掉了什么?
想改进这个问题吗 通过编辑此帖子,添加详细信息并澄清问题。 这就是我实际导入firestore依赖项时发生的情况,我认为这一切都与连接有关,但这些错误一直在发生。请帮帮我 问题:任务“:app:mergeExtDexDebug”的执行失败 无法解析配置“:应用:调试运行时类路径”的所有文件。无法转换 firebase-storage-19.2.1.aar (com.google.firebase: