Android NDK找不到库

时间:2015-12-15 11:11:35

标签: android gradle android-ndk

我正在制作Android应用并使用NDK进行一些复杂的计算,我在编译时遇到问题。我使用的是Android 2.0 Preview 3b和NDK r10e。

我在加载一些像这样的普通库时遇到问题:

#include <math.h>
#include <android/log.h>
#include <stdlib.h>

错误是Cannot find。 在local.properities我有ndk.dir=F\:\\android-ndk-r10e 在'gradle.build'我有

apply plugin: 'com.android.model.application'
model {

    android {
        compileSdkVersion = 23
        buildToolsVersion = "23.0.2"
        defaultConfig.with {
            multiDexEnabled = true
            applicationId = "lala.lala"
            minSdkVersion.apiLevel = 16
            targetSdkVersion.apiLevel = 23
            versionCode = 1
            versionName = "1.0"
        }
    }
    android.ndk {
        moduleName = "lala"
    }
    android.buildTypes {
        release {
            minifyEnabled = false
            proguardFiles += file('proguard-rules.txt')
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.android.support:cardview-v7:23.1.1'
    compile 'com.android.support:recyclerview-v7:23.1.1'
    compile 'com.google.android.gms:play-services-ads:8.3.0'
    compile 'com.google.android.gms:play-services-analytics:8.3.0'
    compile 'com.google.android.gms:play-services-appindexing:8.3.0'
}

这是jni文件夹中的Android.mk:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := lala

LOCAL_CFLAGS := -DANDROID_NDK \
                -DDISABLE_IMPORTGL

LOCAL_SRC_FILES := lala.c lalal.c
LOCAL_LDLIBS    := -lm -llog

include $(BUILD_SHARED_LIBRARY)

和Application.mk:

APP_OPTIM := release
APP_ABI := armeabi armeabi-v7a

0 个答案:

没有答案