Jon
Jon

Reputation: 1499

Building all ABIs but packaging only a subset

I am attempting to build all ABIs for my project but would only like to package a subset of them into my app. For example, I would like to build "x86", "x86_64", "armeabi-v7a" and "arm64-v8a" but only package "x86" (for example).

Reading this document (https://developer.android.com/studio/projects/gradle-external-native-builds.html#jniLibs) under section "Specify ABIs", it seems very possible using the snippet they provided as an example. However, this does not seem to be working for me.

My code snippet is as follows.

android {
    defaultConfig {
        ndk {
            abiFilters 'armeabi-v7a'
        }
        externalNativeBuild {
            cmake {
                abiFilters 'armeabi-v7a', 'x86'
            }
        }
    }
    externalNativeBuild {
        cmake {
            path "CMakeLists.txt"
        }
    }
}

In the snippet above, from my understanding of the document, it should build both armeabi-v7a and x86, but only package armeabi-v7a in my APK. This is not working though.

I am using Android plugin 3.1.0 and NDK 16.1.4479499

Upvotes: 0

Views: 127

Answers (1)

Alex Cohn
Alex Cohn

Reputation: 57173

what you are looking for, is controlled by splits.

splits {
    abi {
        enable true
        reset()
        include 'armeabi-v7a'
        universalApk false //don't generate an additional APK that contains all the ABIs
    }
}

Upvotes: 2

Related Questions