android - 错误:<内存>在具有JNI的Android上没有此类文件或目录

标签 android android-studio gradle java-native-interface crypto++

我正在尝试使用JNI在Android上编译Crypto ++库。我已经克隆了https://github.com/morgwai/ndktutorial项目。我将项目导入android studio,可以调用JNI类并读取Crypto ++,但是当调用该库时,出现内部错误,提示“内存”,没有指向#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

先感谢您。

最佳答案


APP_STL = c++_shared

到您的Application.mk

关于android - 错误:<内存>在具有JNI的Android上没有此类文件或目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40047190/

相关文章:

java - Android - 无法在服务中的计时器内访问 TextView

Android - E/Surface:queueBuffer : error queuing buffer to SurfaceTexture, -22 崩溃

java - 将 Activity 结果传递给正确的 fragment

java - 无法执行 android :onClick 的方法

java - 如何导入外部 gradle 脚本文件并在 Gradle 中正确导入插件?

Java/安卓 : Continuously rotate ImageView image on tap of left/right side of screen

java - android recyclerview viewholder Mediaplayer处理点击问题

java - 如何在 Android 中从 url 获取字节图像

android - 最新 gradle 5.4.1 问题 - 字符串中未转义的撇号

android - Travis CI 因支持依赖而失败