Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is that safe to keep only armeabi-v7a for an android apk

I have an android APK that use a native library (snappydb). The native libraries takes a lot of spaces, so I want to keep only the snappydb for armeabi-v7a architectures?

I know it's not 100% safe to remove snappydb for other architectures, so my question is: how unsafe it is? (how many devices/users will I lost?)

Just for reference, the minimal sdk version that my app support is 16 (JELLY_BEAN).

like image 457
huangcd Avatar asked Jul 14 '15 06:07

huangcd


1 Answers

I suggest using Gradle's productFlavors to produce different APKs per ABI, as some ABI may include some assembly code optimization (SSE4, SSE5, Arm Neon etc,)

android {
    ...

    flavorDimensions "abi", "version"

    productFlavors {
        freeapp {
            flavorDimension "version"
            ...
        }

        x86 {
            flavorDimension "abi"
            ...
        }
    }
 }

Or if you're using the experimental Gradle plugin 'com.android.tools.build:gradle-experimental:0.1.0'

android.productFlavors {
        create ("arm7") {
            ndk.abiFilters += "armeabi-v7a"
        }
        create ("arm8") {
            ndk.abiFilters += "arm64-v8a"
        }
        create ("x86-32") {
            ndk.abiFilters += "x86"
        }
        // for detailed abiFilter descriptions, refer to "Supported ABIs" @
        // https://developer.android.com/ndk/guides/abis.html#sa
        // build one including all productFlavors
        create("fat")
    }
like image 139
Nabil Hachicha Avatar answered Oct 06 '22 04:10

Nabil Hachicha