How to build an Android Gradle based app with NDK only for the ARM target?

那年仲夏 提交于 2019-11-28 10:35:07

Tested on Android SDK 26, NDK 15.2

On the file app/build.gradle:

android {
    defaultConfig {
        ndk {
            abiFilters 'arm64-v8a'

will build only for arm64-v8a, or for all currently non-deprecated ARM targets:

abiFilters 'arm64-v8a', 'armeabi-v7a'

ABI list currently at: https://developer.android.com/ndk/guides/abis.html

Tested on Ubuntu 17.10 host, Android Studio 3, Android SDK 26, NDK 15.2, and an Android 6.0.1 device.

Sample project on GitHub.

Simply move abiFilters into the android.ndk section:

model {
    android.ndk {
        moduleName = "remote_client"
        CFlags += ['-std=c99', '-fstrict-aliasing']
        ldLibs += ["log", "remoted_client"]
        abiFilters = ['armeabi']
    }
}

Finally I made it. Here's an example to disable specific task. Add this line on your build.gradle

tasks.getByPath(":app:linkMipsDebugRemoteDesktopSharedLibrary").enabled = false
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!