How to import only selected native library ABIs from AAR?

烈酒焚心 提交于 2019-12-03 04:24:32
mksaint13
packagingOptions {
    exclude 'lib/arm64-v8a/libcrashlytics-envelope.so'
    exclude 'lib/arm64-v8a/libcrashlytics.so'
    exclude 'lib/armeabi/libcrashlytics-envelope.so'
    exclude 'lib/armeabi/libcrashlytics.so'
    exclude 'lib/mips64/libcrashlytics-envelope.so'
    exclude 'lib/mips64/libcrashlytics.so'
    exclude 'lib/mips/libcrashlytics-envelope.so'
    exclude 'lib/mips/libcrashlytics.so'
    exclude 'lib/x86_64/libcrashlytics-envelope.so'
    exclude 'lib/x86_64/libcrashlytics.so'
}

This works for me:

(e.g: only armeabi & armeabi-v7a)

build.gradle

android{
    defaultConfig{
        ndk{
            abiFilters "armeabi", "armeabi-v7a"
        }
    }
}

Mike from Fabric and Crashlytics here. With Splits, currently, we don't know in advance which density to provide the tester, so just add this line to your specific flavor or variant, to use the universal APK that is generated.

ext.betaDistributionApkFilePath = "path to the universal split APK"

Also, if you're using NDK crash reporting, in case it matches the crash you're seeing, check out this link.

I had the same problem as you, but you actually helped me with the link you posted about APK Splits! In your case, try to add the following to your build.gradle inside the android closure:

    splits {
        abi {
            enable true
            reset()
            include 'armeabi-v7a', 'x86'
            universalApk true
        }
    }

The trick in there is to set the universalApk to true in order to generate only one APK with all the defined architectures, instead of splitting them up in several APKs.

Also don't forget the reset() which removes all the default values.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!