'android release app bundle build missing native lib .so files

case

I have an app

when i work with it in debug mode everything is ok !

but when i try to build apk bundle for release and try to install app through play store the is missing the .so files i reverse- engineered the apk and couldn't find a single .so file or any lib folder

but when i analyse the bundle using play console and android studio it contains all the abi folders with respective .so files

this is my app gradle file

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.test"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 38
        versionName "3.0.8"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        // Enabling multidex support.
        multiDexEnabled true
        //render script
        renderscriptTargetApi 28
        renderscriptSupportModeEnabled true
        externalNativeBuild {
            cmake {
                cppFlags "-frtti -fexceptions"
                arguments "-DANDROID_STL=c++_shared"
            }
        }
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    externalNativeBuild {
        cmake {
            path "CMakeLists.txt"
        }
    }
    packagingOptions {
        exclude 'META-INF/rxjava.properties'
        exclude "lib/mips/libRSSupport.so"
        exclude "lib/mips/librsjni.so"

    }
    compileOptions {
        sourceCompatibility = '1.8'
        targetCompatibility = '1.8'
    }
}

dependencies {
    //custom modules here
    //libs and jars
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    //other dependencies
}

apply plugin: 'com.google.gms.google-services'

here are the some images

android studio apk analysis

i could't screenshot whole page but it had all the possible abis

play console app bundle exploere

error

Fatal Exception: java.lang.UnsatisfiedLinkError
dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.test-1/base.apk"],nativeLibraryDirectories=[/data/app/com.test-1/lib/arm, /data/app/com.test-1/base.apk!/lib/armeabi, /vendor/lib, /system/lib]]] couldn't find "libnative-lib.so"

what all i have tried

i have tried putting ndkFilters, splits, abis, disabling progaurd, etc. in gradle file

but no luck

i think

play console is failing to distribute the lib to respective abis

request

anyone got any clue of it please tell me _/\_

thank you



Solution 1:[1]

Add the following to gradle.properties, it should help:

android.bundle.enableUncompressedNativeLibs = false

Solution 2:[2]

Try this:

sourceSets.main.jniLibs.srcDirs = ['src/main/jniLibs']

Solution 3:[3]

If the above solutions are invalid, you can try to build once with the debug mode package of the dependent library, and then replace it with the release mode package. After a lot of solutions, I found that this method works, maybe it is related to the compiler cache.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Vadik
Solution 2 Hafez Divandari
Solution 3 dky