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!