How do I set the APP-PLATFORM in Application.mk to

2019-08-27 06:32发布

问题:

I'm trying to import Y.C.Tung's AndroidLibSVM into my project, but when i run the code on my Android 6.0.1 Tablet, i get this error:

java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__aeabi_memcpy"

According to this post or this one among a few others, the error can be fixed by upgrading the APP-PLATFORM in the NDK's application.mk/android.mk to match the targetSDKversion of the applikation. However, i cannot find these .mk files. They should be

"in a subdirectory of your project's jni/ directory",

but I don't know where that is as well. This is my build.gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 28
defaultConfig {
    applicationId "com.krautkremer.nils.mymirror"
    minSdkVersion 23
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    externalNativeBuild {
        cmake {
            cppFlags ""
        }
    }
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
packagingOptions {
    exclude 'META-INF/proguard/androidx-annotations.pro'
}

externalNativeBuild {
    cmake {
        path "CMakeLists.txt"
    }
}

}

I don't know much about the NDK and i'm quite new to Java/Android/Android Studio/Gradle. Appreciate the help!

回答1:

You don't. You NDK API version needs to match your minSdkVersion. You app is not guaranteed to run on any release lower than your NDK API version. externalNativeBuild handles this automatically. If you need to use API 28 for your NDK libraries, you need to set your minSdkVersion to 28.

However, I don't think that's the problem here. This question has come up three times in the last two weeks. It looks like AndroidLibSVM was built against android-24 or higher. As such, it cannot be used on devices older than that API level (all the other questions were trying to use it on android-23).