android 发布应用程序包构建缺少本机 lib .so 文件

Har*_*Kal 5 android android-ndk android-studio android-gradle-plugin android-bundle

案件

我有一个应用程序

当我在调试模式下使用它时,一切正常!

但是当我尝试构建用于发布的 apk 包并尝试通过 Play 商店安装应用程序时,缺少 .so 文件,我对 apk 进行了逆向工程,但找不到单个 .so 文件或任何 lib 文件夹

但是当我使用播放控制台和 android studio 分析包时,它包含所有带有相应 .so 文件的 abi 文件夹

这是我的应用程序 gradle 文件

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'
Run Code Online (Sandbox Code Playgroud)

这是一些图片

android studio apk分析

我无法截取整个页面,但它有所有可能的 abis

播放控制台应用程序包 exploere

错误

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"
Run Code Online (Sandbox Code Playgroud)

我都试过了

我曾尝试将 ndkFilters、splits、abis、禁用 progaurd 等放在 gradle 文件中

但没有运气

我认为

play 控制台无法将 lib 分发到相应的 abis

要求

任何人有任何线索请告诉我 _/\_

谢谢你

小智 8

将以下内容添加到gradle.properties,应该会有所帮助:

android.bundle.enableUncompressedNativeLibs = false
Run Code Online (Sandbox Code Playgroud)


Ale*_*ohn 2

使用 abifFilters 从您的包中删除过时的 ABI。你不需要armeabimips

也许,您尝试在设备上安装armeabi split。问题在于,armeabi拆分确实存在(它包含来自某些依赖项的库),但较新的 NDK 并未构建libnative-lib.so.