我正在尝试加载图像使用壁画库,但我有一个奇怪的问题。
png图像正在加载,但我加载的是jpg图像我使用的壁画版本是2.0.0,我尝试了一切无效缓存,改变壁画版本,清除数据,重建项目。但对我来说没有任何意义。
不工作
fresco_img.setImageURI("http://static.tvmaze.com/uploads/images/medium_portrait/213/533527.jpg")
fresco_img.setImageURI("https://raw.githubusercontent.com/facebook/fresco/master/docs/static/logo.png")
//初始化壁画
Fresco.initialize(this)
您可以在下面看到所有的日志:
2019-11-21 12:11:29.448 28592-28592/? I/com.koa.tvmaze: Late-enabling -Xcheck:jni
2019-11-21 12:11:30.179 28592-28592/com.koa.tvmaze I/Perf: Connecting to perf service.
2019-11-21 12:11:30.195 28592-28592/com.koa.tvmaze I/MultiDex: VM with version 2.1.0 has multidex support
2019-11-21 12:11:30.195 28592-28592/com.koa.tvmaze I/MultiDex: Installing application
2019-11-21 12:11:30.195 28592-28592/com.koa.tvmaze I/MultiDex: VM has multidex support, MultiDex support library is disabled.
2019-11-21 12:11:30.195 28592-28592/com.koa.tvmaze I/MultiDex: Installing application
2019-11-21 12:11:30.195 28592-28592/com.koa.tvmaze I/MultiDex: VM has multidex support, MultiDex support library is disabled.
2019-11-21 12:11:30.222 28592-28592/com.koa.tvmaze D/SoLoader: init start
2019-11-21 12:11:30.222 28592-28592/com.koa.tvmaze D/SoLoader: adding system library source: /vendor/lib
2019-11-21 12:11:30.223 28592-28592/com.koa.tvmaze D/SoLoader: adding system library source: /system/lib
2019-11-21 12:11:30.224 28592-28592/com.koa.tvmaze D/SoLoader: adding application source: com.facebook.soloader.DirectorySoSource[root = /data/app/com.koa.tvmaze-tSzb6qZR88CUMaXdWVOFTg==/lib/arm64 flags = 0]
2019-11-21 12:11:30.228 28592-28592/com.koa.tvmaze D/SoLoader: adding backup source from : com.facebook.soloader.ApkSoSource[root = /data/data/com.koa.tvmaze/lib-main flags = 1]
2019-11-21 12:11:30.228 28592-28592/com.koa.tvmaze D/SoLoader: Preparing SO source: com.facebook.soloader.DirectorySoSource[root = /system/lib flags = 2]
2019-11-21 12:11:30.228 28592-28592/com.koa.tvmaze D/SoLoader: Preparing SO source: com.facebook.soloader.DirectorySoSource[root = /vendor/lib flags = 2]
2019-11-21 12:11:30.228 28592-28592/com.koa.tvmaze D/SoLoader: Preparing SO source: com.facebook.soloader.DirectorySoSource[root = /data/app/com.koa.tvmaze-tSzb6qZR88CUMaXdWVOFTg==/lib/arm64 flags = 0]
2019-11-21 12:11:30.228 28592-28592/com.koa.tvmaze D/SoLoader: Preparing SO source: com.facebook.soloader.ApkSoSource[root = /data/data/com.koa.tvmaze/lib-main flags = 1]
2019-11-21 12:11:30.230 28592-28592/com.koa.tvmaze V/fb-UnpackingSoSource: locked dso store /data/user/0/com.koa.tvmaze/lib-main
2019-11-21 12:11:30.233 28592-28592/com.koa.tvmaze V/fb-UnpackingSoSource: deps mismatch on deps store: regenerating
2019-11-21 12:11:30.233 28592-28592/com.koa.tvmaze V/fb-UnpackingSoSource: so store dirty: regenerating
2019-11-21 12:11:30.332 28592-28592/com.koa.tvmaze D/ApkSoSource: not allowing consideration of lib/arm64-v8a/libimagepipeline.so: deferring to libdir
2019-11-21 12:11:30.332 28592-28592/com.koa.tvmaze D/ApkSoSource: not allowing consideration of lib/arm64-v8a/libnative-filters.so: deferring to libdir
2019-11-21 12:11:30.332 28592-28592/com.koa.tvmaze D/ApkSoSource: not allowing consideration of lib/arm64-v8a/libnative-imagetranscoder.so: deferring to libdir
2019-11-21 12:11:30.333 28592-28592/com.koa.tvmaze V/fb-UnpackingSoSource: regenerating DSO store com.facebook.soloader.ApkSoSource
2019-11-21 12:11:30.334 28592-28592/com.koa.tvmaze V/fb-UnpackingSoSource: Finished regenerating DSO store com.facebook.soloader.ApkSoSource
2019-11-21 12:11:30.334 28592-28592/com.koa.tvmaze V/fb-UnpackingSoSource: starting syncer worker
2019-11-21 12:11:30.347 28592-28592/com.koa.tvmaze V/fb-UnpackingSoSource: releasing dso store lock for /data/user/0/com.koa.tvmaze/lib-main (from syncer thread)
2019-11-21 12:11:30.347 28592-28592/com.koa.tvmaze V/fb-UnpackingSoSource: not releasing dso store lock for /data/user/0/com.koa.tvmaze/lib-main (syncer thread started)
2019-11-21 12:11:30.347 28592-28592/com.koa.tvmaze D/SoLoader: init finish: 4 SO sources prepared
2019-11-21 12:11:30.347 28592-28592/com.koa.tvmaze D/SoLoader: init exiting
2019-11-21 12:11:30.473 28592-28592/com.koa.tvmaze W/com.koa.tvmaze: Accessing hidden method Landroid/graphics/drawable/Drawable;->getOpticalInsets()Landroid/graphics/Insets; (light greylist, linking)
2019-11-21 12:11:30.473 28592-28592/com.koa.tvmaze W/com.koa.tvmaze: Accessing hidden field Landroid/graphics/Insets;->left:I (light greylist, linking)
2019-11-21 12:11:30.473 28592-28592/com.koa.tvmaze W/com.koa.tvmaze: Accessing hidden field Landroid/graphics/Insets;->right:I (light greylist, linking)
2019-11-21 12:11:30.473 28592-28592/com.koa.tvmaze W/com.koa.tvmaze: Accessing hidden field Landroid/graphics/Insets;->top:I (light greylist, linking)
2019-11-21 12:11:30.473 28592-28592/com.koa.tvmaze W/com.koa.tvmaze: Accessing hidden field Landroid/graphics/Insets;->bottom:I (light greylist, linking)
2019-11-21 12:11:30.490 28592-28592/com.koa.tvmaze I/DecorView: It non-support bigbang
2019-11-21 12:11:30.494 28592-28592/com.koa.tvmaze I/PhoneWindow: isNeedChangeNaviBarColor taskInfo: [android.app.ActivityManager$RunningTaskInfo@2114b67] size: 1
2019-11-21 12:11:30.495 28592-28592/com.koa.tvmaze I/PhoneWindow: isAPPNeedChange pkgName: com.koa.tvmaze needKeep: false
2019-11-21 12:11:30.495 28592-28592/com.koa.tvmaze I/PhoneWindow: isNeedChangeNaviBarColor false
2019-11-21 12:11:30.495 28592-28592/com.koa.tvmaze I/PhoneWindow: generateLayout mNavigationBarColor: ff000000
2019-11-21 12:11:30.496 28592-28592/com.koa.tvmaze I/PhoneWindow: generateLayout isLightNavi false, Visibility: 0
2019-11-21 12:11:30.541 28592-28592/com.koa.tvmaze W/com.koa.tvmaze: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (light greylist, reflection)
2019-11-21 12:11:30.543 28592-28592/com.koa.tvmaze W/com.koa.tvmaze: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (light greylist, reflection)
2019-11-21 12:11:30.616 28592-28592/com.koa.tvmaze D/OpenGLRenderer: Skia GL Pipeline
2019-11-21 12:11:30.672 28592-28625/com.koa.tvmaze I/Adreno: QUALCOMM build : a4d39a0, I6fd668c4d3
Build Date : 10/05/18
OpenGL ES Shader Compiler Version: EV031.25.03.01
Local Branch :
Remote Branch : refs/tags/AU_LINUX_ANDROID_LA.UM.7.2.R1.09.00.00.442.049
Remote Branch : NONE
Reconstruct Branch : NOTHING
2019-11-21 12:11:30.672 28592-28625/com.koa.tvmaze I/Adreno: Build Config : S L 6.0.7 AArch64
2019-11-21 12:11:30.676 28592-28628/com.koa.tvmaze I/DpmTcmClient: RegisterTcmMonitor from: com.android.okhttp.TcmIdleTimerMonitor
2019-11-21 12:11:30.680 28592-28625/com.koa.tvmaze I/Adreno: PFP: 0x005ff112, ME: 0x005ff066
2019-11-21 12:11:30.680 28592-28628/com.koa.tvmaze D/NetworkSecurityConfig: No Network Security Config specified, using platform default
2019-11-21 12:11:30.685 28592-28625/com.koa.tvmaze I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
2019-11-21 12:11:30.685 28592-28625/com.koa.tvmaze I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
2019-11-21 12:11:30.686 28592-28625/com.koa.tvmaze I/OpenGLRenderer: Initialized EGL, version 1.4
2019-11-21 12:11:30.686 28592-28625/com.koa.tvmaze D/OpenGLRenderer: Swap behavior 2
URI是http,而不是https,这可能导致了您的问题。https://stackoverflow.com/a/50834600中概述了几种解决方案,例如允许您的域:
创建文件res/xml/network_security_config.xml-
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">tvmaze.com</domain>
</domain-config>
</network-security-config>
我是如何调试的:当您启用Fresco调试(https://frescolib.org/docs/faq.html)时,您会发现您的图像出现以下错误消息:
11-21 10:28:42.038 24149 24225 W unknown:RequestLoggingListener: time 588743228: onProducerFinishWithFailure: {requestId: 34, stage: NetworkFetchProducer, elapsedTime: 5 ms, extraMap: null, throwable: java.net.UnknownServiceException: CLEARTEXT communication to static.tvmaze.com not permitted by network security policy}
11-21 10:28:42.038 24149 24225 W unknown:RequestLoggingListener: java.net.UnknownServiceException: CLEARTEXT communication to static.tvmaze.com not permitted by network security policy
11-21 10:28:42.038 24149 24225 W unknown:RequestLoggingListener: at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:147)
11-21 10:28:42.038 24149 24225 W unknown:RequestLoggingListener: at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:257)
11-21 10:28:42.038 24149 24225 W unknown:RequestLoggingListener: at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:135)
11-21 10:28:42.038 24149 24225 W unknown:RequestLoggingListener: at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:114)
11-21 10:28:42.038 24149 24225 W unknown:RequestLoggingListener: at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
11-21 10:28:42.038 24149 24225 W unknown:RequestLoggingListener: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
11-21 10:28:42.038 24149 24225 W unknown:RequestLoggingListener: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
11-21 10:28:42.038 24149 24225 W unknown:RequestLoggingListener: at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
11-21 10:28:42.038 24149 24225 W unknown:RequestLoggingListener: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
11-21 10:28:42.038 24149 24225 W unknown:RequestLoggingListener: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
11-21 10:28:42.038 24149 24225 W unknown:RequestLoggingListener: at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
11-21 10:28:42.038 24149 24225 W unknown:RequestLoggingListener: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
11-21 10:28:42.038 24149 24225 W unknown:RequestLoggingListener: at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126)
11-21 10:28:42.038 24149 24225 W unknown:RequestLoggingListener: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
11-21 10:28:42.038 24149 24225 W unknown:RequestLoggingListener: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
11-21 10:28:42.038 24149 24225 W unknown:RequestLoggingListener: at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:254)
11-21 10:28:42.038 24149 24225 W unknown:RequestLoggingListener: at okhttp3.RealCall$AsyncCall.execute(RealCall.java:200)
11-21 10:28:42.038 24149 24225 W unknown:RequestLoggingListener: at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
11-21 10:28:42.038 24149 24225 W unknown:RequestLoggingListener: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
11-21 10:28:42.038 24149 24225 W unknown:RequestLoggingListener: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
11-21 10:28:42.038 24149 24225 W unknown:RequestLoggingListener: at java.lang.Thread.run(Thread.java:764)
FaceBook推出的Android图片加载库-Fresco > 原文链接:Introducing Fresco: A new image library for Android 作者 : tyrone Nicholas 译者 : ZhaoKaiQiang 校对者: Chaossss 校对者: bboyfeiyu 校对者: BillionWang 状态 : 完成 在Android设备上面,快速高效
本文向大家介绍Fresco加载手机图片墙,包括了Fresco加载手机图片墙的使用技巧和注意事项,需要的朋友参考一下 本文实例为大家分享了Android九宫格图片展示的具体代码,供大家参考,具体内容如下 //网络权限 //添加依赖 布局文件 activity_main activity_zoom_image fresco_item MyViewHolder MyRecyclerViewAdapter
我试了所有的办法,但似乎都不奏效。据我说,图像的路径是正确的。(虽然我附上了一张图片供参考)。这就是我得到的错误- 这是**pubspec.yaml*- 名称:foodfast描述:一个新的颤振项目。 Publish_To:'none' 版本:1.0.0+1 环境:SDK:“>=2.7.0<3.0.0” 依赖项:flutter:SDK:flutter 弹出屏幕:^1.3.5 cupertino_i
本文向大家介绍详解Android之图片加载框架Fresco基本使用(一),包括了详解Android之图片加载框架Fresco基本使用(一)的使用技巧和注意事项,需要的朋友参考一下 PS:Fresco这个框架出的有一阵子了,也是现在非常火的一款图片加载框架.听说内部实现的挺牛逼的,虽然自己还没研究原理.不过先学了一下基本的功能,感受了一下这个框架的强大之处.本篇只说一下在xml中设置属性的相关用法.
这与其他图像加载库(如Glide和Picasso)一样常见吗?难道只有Android9才会出现这种情况吗?
我正在寻找Android中的异步图像加载和缓存库。我本来打算用毕加索,但我发现通用图像加载器在GitHub上更受欢迎。有人知道这两个图书馆吗?总结一下利弊就好了。 (我所有的图像都在本地磁盘上,因此我不需要联网,因此我认为凌空截击不合适)