android studio 64位手机+Fresco引起的在arm64位机器上找不到对应的so库

我们的程序在32位机器上没有问题,有一天公司采购了一台魅族MX5

MTK的64位处理器上我们的应用报错了

"nativeLibraryDirectories=[/data/app/com.lukouapp-1/lib/arm64, /vendor/lib64, /system/lib64]]] couldn't find "libxxxx.so" 

仔细排查后发现是因为使用了Fresco

通过排查fresco的issue-关于64bit的问题发现

Issue#504

Issue#458

问题原因:64位机器默认去查找arm64-v8a目录下是否有合适的64位库,如果没有则回去libs下查找32位的库,而fresco的draw-pipeline太完善了考虑了64位的机器所以他的arm64-v8a下有so库,

对应的系统就创建了lib64的文件,而不再去找32位的库。

解决方案:

 

复制代码
Edit your build.gradle file as follows:

android {
  // rest of your app's logic
  splits {
    abi {
        enable true
        reset()
        include 'x86', 'x86_64', 'arm64-v8a', 'armeabi-v7a', 'armeabi'
        universalApk false
    }
  }
}

(*)注意上面的红色部分要删除掉最后看起来是这样:
复制代码
复制代码
android {
  // rest of your app's logic
  splits {
    abi {
        enable true
        reset()
        include 'x86', 'x86_64', 'armeabi-v7a', 'armeabi'
        universalApk false
    }
  }
}
复制代码

原理:

enable: enables the ABIs split mechanism
exclude: By default all ABIs are included, you can remove some ABIs.
include: indicate which ABIs to be included
reset(): reset the list of ABIs to be included to an empty string (this allows, in conjunctions with  include, to indicate which one to use rather than which ones to ignore)
universalApk: indicates whether to package a universal version (with all ABIs) or not. Default is false.

 

注意:如果加入上面代码还不行 ,可以注释掉下面这行(如果你的主要工程目录没有加入lib和jar的话)

  

dependencies {
//    compile fileTree(include: ['*.jar'], dir: 'libs')
    }

 

评论:

#1楼   2015-08-26 10:02 |  ysl_longer   
哥们,这样的话 那你会打出很多个不同架构的包,但是每个包仅仅包含一个架构型号吧。
我想要的效果是出去'arm64-v8a'架构之外的都要打到同一个包里面去,该怎么做呢?
  
#2楼 [ 楼主2015-08-26 12:38 |  小老虎2   
@ ysl_longer
试试吧 最后一个设为true,universalApk true
  
#3楼   2015-08-26 13:33 |  ysl_longer   
@ 小老虎2
试过了 不行哎



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值