Android 9.0 Pie的Picasso图像加载问题 [英] Picasso image loading issue with Android 9.0 Pie

查看:564
本文介绍了Android 9.0 Pie的Picasso图像加载问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法使用Android 9.0 Pie中的Picasso库加载图像.实际上,它适用于以下版本. 它没有显示任何错误消息. 有人使用

I am not able to load images using Picasso library in Android 9.0 Pie. Actually, it works fine for below versions. It is not showing any error message. Someone has shared his logs on Github using

Picasso.get().setLoggingEnabled(true);

他有消息日志:

2018-10-19 13:13:20.467 24840-24862/com.xyz.test.testpicasso D/ViewContentFactory: initViewContentFetcherClass
2018-10-19 13:13:20.467 24840-24862/com.xyz.test.testpicasso I/ContentCatcher: ViewContentFetcher : ViewContentFetcher
2018-10-19 13:13:20.467 24840-24862/com.xyz.test.testpicasso D/ViewContentFactory: createInterceptor took 0ms
2018-10-19 13:13:20.468 24840-24862/com.xyz.test.testpicasso I/ContentCatcher: Interceptor : Catcher list invalid for com.xyz.test.testpicasso@com.xyz.test.testpicasso.MainActivity@147874166
2018-10-19 13:13:20.468 24840-24862/com.xyz.test.testpicasso I/ContentCatcher: Interceptor : Get featureInfo from config pick_mode
2018-10-19 13:13:20.485 24840-24840/com.xyz.test.testpicasso D/Picasso: Main        created      [R1] Request{https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png}
2018-10-19 13:13:20.492 24840-24864/com.xyz.test.testpicasso D/Picasso: Dispatcher  enqueued     [R1]+6ms 
2018-10-19 13:13:20.492 24840-24866/com.xyz.test.testpicasso D/Picasso: Hunter      executing    [R1]+7ms 
2018-10-19 13:13:20.555 1531-1684/? I/ActivityManager: Displayed com.xyz.test.testpicasso/.MainActivity: +114ms
2018-10-19 13:13:20.555 5475-5603/? D/PowerKeeper.Event: notifyActivityLaunchTime: com.xyz.test.testpicasso/.MainActivity totalTime: 114
2018-10-19 13:13:20.709 735-816/? W/SurfaceFlinger: Attempting to set client state on removed layer: Splash Screen com.xyz.test.testpicasso#0
2018-10-19 13:13:20.710 735-816/? W/SurfaceFlinger: Attempting to destroy on removed layer: Splash Screen com.xyz.test.testpicasso#0
2018-10-19 13:13:20.775 1531-1684/? I/Timeline: Timeline: Activity_windows_visible id: ActivityRecord{821c51 u0 com.xyz.test.testpicasso/.MainActivity t4372} time:9356677
2018-10-19 13:13:21.003 24840-24864/com.xyz.test.testpicasso D/Picasso: Dispatcher  retrying     [R1]+518ms 
2018-10-19 13:13:21.004 24840-24872/com.xyz.test.testpicasso D/Picasso: Hunter      executing    [R1]+519ms 
2018-10-19 13:13:21.513 24840-24864/com.xyz.test.testpicasso D/Picasso: Dispatcher  retrying     [R1]+1027ms 
2018-10-19 13:13:21.514 24840-24877/com.xyz.test.testpicasso D/Picasso: Hunter      executing    [R1]+1028ms 
2018-10-19 13:13:21.516 24840-24864/com.xyz.test.testpicasso D/Picasso: Dispatcher  batched      [R1]+1030ms for error
2018-10-19 13:13:21.717 24840-24864/com.xyz.test.testpicasso D/Picasso: Dispatcher  delivered    [R1]+1232ms

推荐答案

尝试在清单文件的应用程序标记中使用android:usesCleartextTraffic="true"! 由于我在使用Android Volley时遇到同样的问题!

Try Using android:usesCleartextTraffic="true" in Application Tag of your Manifest file! As i faced same issue using Android Volley!

根据Android文档

As per Android Documentation

指示应用程序是否打算使用明文网络流量,例如明文HTTP.定位到 API级别27或更低的应用的默认值为"true".定位到 API级别28或更高的应用默认为"false".

Indicates whether the app intends to use cleartext network traffic, such as cleartext HTTP. The default value for apps that target API level 27 or lower is "true". Apps that target API level 28 or higher default to "false".

当 属性设置为"false",平台组件(例如,HTTP 和FTP堆栈,DownloadManager,MediaPlayer)将拒绝该应用的 请求使用明文流量.第三方库是强大的 也鼓励您遵守此设置.避免的主要原因 明文流量缺乏机密性,真实性和 防止篡改的保护措施:网络攻击者可以窃听 传输数据,并在未检测到的情况下对其进行修改. 链接

When the attribute is set to "false", platform components (for example, HTTP and FTP stacks, DownloadManager, MediaPlayer) will refuse the app's requests to use cleartext traffic. Third-party libraries are strongly encouraged to honor this setting as well. The key reason for avoiding cleartext traffic is the lack of confidentiality, authenticity, and protections against tampering: a network attacker can eavesdrop on transmitted data and also modify it without being detected. link

这篇关于Android 9.0 Pie的Picasso图像加载问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆