Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reduce build variants of native library in Android Studio 3.3?

In Android Studio 3.2.1 I had two build variants visible for my native library; Release and Debug. In 3.3 I get a combination of these and all ABIs. I don't want to build multiple APKs for all the ABIs.

Build variants for all ABIs?!

The relevant parts of the native library project:

apply plugin: 'com.android.library'

android {
    defaultConfig {
        ndk {
            // Specifies the ABI configurations of your native
            // libraries Gradle should build and package with your APK.
            abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
        }
    }

    buildTypes {
        release {
        }
        debug {
        }
    }

    externalNativeBuild {
        ndkBuild {
            path 'jni/Android.mk'
        }
    }

    sourceSets {
        main {
            java.srcDir generatedSrcDir
        }
    }

    sourceSets {
        main {
            jni.srcDirs = []
        }
    }
}

Build warnings

Maybe unrelated, but I observed this warning in the Build log (actually twice in a row):

WARNING: ABIs [arm64-v8a,armeabi-v7a,armeabi] set by 'android.injected.build.abi' gradle flag contained 'ARMEABI' not targeted by this project.

How do I get back to the old behavior?

like image 276
l33t Avatar asked Jan 14 '19 22:01

l33t


1 Answers

Apparently this is an intentional change: see this issue.

According to the linked ticket, this is only "cosmetic"(ie a UI change); a full/fat .apk is still built.

like image 190
Nathan Prat Avatar answered Oct 18 '22 18:10

Nathan Prat