Fresco使用及问题

Fresco使用及问题
1. Android Studio使用远程依赖时下载不了jar包的解决方法
// 需要添加以下maven库,否则使用远程依赖时,可能无法下载fresco数据:compile ('com.facebook.fresco:fresco:0.4.0+')
// Error:(126, 14) Failed to resolve: com.facebook.fresco:fresco:0.4.0+
allprojects {
   repositories {
       mavenCentral()
   }
}
2. Execution failed for task ':imagepipeline:ndk_build_gifimage'.
  如果你遇到这个错误,多半是找不到ndk环境导致的。配置了NDK环境变量就可以解决了。

3. Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat
// 由于com.facebook.fresco:imagepipeline模块引用了support-v4.jar,
// 如果项目中的其他模块也引用了support-v4.jar, 那么需要去掉其中一个模块对support-v4.jar的引用(exclude module: 'support-v4')
// 否则将会出现无法正确引用目标support_v4.jar的情况,或者报以下异常:
// com.android.dex.DexException:
//     Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompatIcs;compile ('com.facebook.fresco:fresco:0.4.0+') {
   exclude module: 'support-v4'
}
4. 自定义网络加载:OkHttp
Image pipeline 默认使用HttpURLConnection。应用可以根据自己需求使用不同的网络库。
OkHttp
OkHttp 是一个流行的开源网络请求库。Image pipeline有一个使用OkHttp替换掉了Android默认的网络请求的补充。
如果需要使用OkHttp, 不要使用这个下载页面的gradle依赖配置,应该使用下面的依赖配置
dependencies {
   // your project's other dependencies
   compile 'com.facebook.fresco:drawee:0.4.0+'
   compile 'com.facebook.fresco:imagepipeline-okhttp:0.4.0+'
}配置Image pipeline这时也有一些不同,不再使用ImagePipelineConfig.newBuilder,而是使用OkHttpImagePipelineConfigFactory:
Context context;
OkHttpClient okHttpClient; // build on your ownImagePipelineConfig config = OkHttpImagePipelineConfigFactory
   .newBuilder(context, okHttpClient)
   . // other setters
   . // setNetworkFetchProducer is already called for you    .build();
Fresco.initialize(context, config);

5. java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[...] couldn't find "libmemchunk.so"
  64位机器暂时还有问题:Fresco does not put any libraries in "lib/arm64", it will be fixed by #176 soon.(已解决)
  Working on version 0.5.1!


转载于:https://my.oschina.net/u/2607809/blog/616097

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值