我正在尝试使用JNI在Android上编译Crypto ++库。我克隆了https://github.com/morgwai/ndktutorial的项目。我将项目导入android studio,我能够调用JNI类并读取Crypto ++,但是当调用库时,我得到一个内部错误,其中“memory”没有指向#include <memory>
的文件或目录。
这是我的build.gradle:
apply plugin: 'com.android.model.application'
model {
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.moham.myapplication"
minSdkVersion.apiLevel 22
targetSdkVersion.apiLevel 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles.add(file('proguard-android.txt'))
}
}
ndk {
moduleName "crypt_user.cpp"
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.1'
}
这也是我编译时遇到的错误:
MYPATH\Android\sdk\ndk-bundle\platforms\android-23\arch-arm64\usr\include\stdcpp.h
Error:(10, 18) memory: No such file or directory
compilation terminated.
Error:Execution failed for task ':app:compileCrypt_userArm64-v8aDebugSharedLibra
ryCrypt_userMainCpp'.
> A build operation failed.
C++ compiler failed while compiling crypt_user.cpp.
See the complete log at: file:///D:/MyApplication/app/build/tmp/compileCrypt_u
serArm64-v8aDebugSharedLibraryCrypt_userMainCpp/output.txt
提前谢谢。
答案 0 :(得分:0)
添加
APP_STL = c++_shared
到您的Application.mk