Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 613
Harkal Avatar asked Aug 20 '19 14:08

Harkal


2 Answers

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

android.bundle.enableUncompressedNativeLibs = false
like image 69
Apoorva Avatar answered Sep 16 '22 16:09

Apoorva


Use abifFilters to remove the obsolete ABIs from your bundle. You don't need armeabi or mips.

Maybe, you tried to install an armeabi split on a device. The problem with this is that an armeabi split does exist (it contains libraries from some dependencies), but the newer NDK did not build this variant of libnative-lib.so.

like image 44
Alex Cohn Avatar answered Sep 17 '22 16:09

Alex Cohn