Bootstrap

/lib/x86, /system/lib, /vendor/lib]]] couldn't find xx.so

近日对接PapPal,对接后在部份手机上会出现崩溃,查看其日志后发现报/lib/x86, /system/lib, /vendor/lib]]] couldn't find xx.so,我解压了打好的apk发现里面有对就的so,

折腾了一天发现,PapPal依赖了arm-v8a.x86_64等,于是报着试试看的心理在Gradle中加入如下配置


packagingOptions {
    exclude "lib/arm64-v8a/libcardioDecider.so"
    exclude "lib/arm64-v8a/libcardioRecognizer.so"
    exclude "lib/arm64-v8a/libcardioRecognizer_tegra2.so"
    exclude "lib/arm64-v8a/libopencv_core.so"
    exclude "lib/arm64-v8a/libopencv_imgproc.so"

    exclude "lib/x86/libcardioDecider.so"
    exclude "lib/x86/libcardioRecognizer.so"
    exclude "lib/x86/libcardioRecognizer_tegra2.so"
    exclude "lib/x86/libopencv_core.so"
    exclude "lib/x86/libopencv_imgproc.so"

    exclude "lib/x86_64/libcardioDecider.so"
    exclude "lib/x86_64/libcardioRecognizer.so"
    exclude "lib/x86_64/libcardioRecognizer_tegra2.so"
    exclude "lib/x86_64/libopencv_core.so"
    exclude "lib/x86_64/libopencv_imgproc.so"
}

即打包时这些屏蔽掉不打入到apk中,就解决了。


事后了解到,因为包含了这些平台的文件夹,系统会到相应平台下找你写的 loadLibary,因为没找到,所以就报错了,有人说不是64位能兼容到32位么,这里你想有64位文件夹下有可用的SO了,那么相应的其他库也应有,如果没有就会报错。所以按照上述方法就解决了

;