平板电脑

时间:2018-05-14 09:29:30

标签: java android caching picasso

我在recyclerview中使用毕加索这样:

Picasso.with(context).load(contects.get(position).getLogo()).memoryPolicy(MemoryPolicy.NO_CACHE )
               .networkPolicy(NetworkPolicy.NO_CACHE).error(R.mipmap.ic_launcher).into(holder.ImageView);

但我在毕加索日志上得到这个:

D/Picasso: Main        created      [R0] Request{https://debo3.com/wp- content/uploads/2017/08/abstract-logo-template_1331-33.jpg}
D/Picasso: Dispatcher  enqueued     [R0]+11ms 
D/Picasso: Hunter      executing    [R0]+14ms 
D/Picasso: Main        created      [R1] Request{https://debo3.com/wpcontent/uploads/2017/08/abstract-logo-template_1331-33.jpg}
D/Picasso: Hunter      joined       [R1]+1ms to [R0]+17ms, [R1]+1ms
W/System.err: remove failed: ENOENT (No such file or directory) : /data/data/com.example.ahmadi.khadamat/cache/picasso-cache/journal.tmp
D/Picasso: Main        created      [R2] Request{https://debo3.com/wp-content/uploads/2017/08/abstract-logo-template_1331-33.jpg}
D/Picasso: Hunter      joined       [R2]+1ms to [R0]+21ms, [R1]+5ms, [R2]+1ms
D/Picasso: Dispatcher  retrying     [R0]+20s, [R1]+20s, [R2]+20s 
D/Picasso: Hunter      executing    [R0]+20s, [R1]+20s, [R2]+20s 
D/Picasso: Dispatcher  retrying     [R0]+41s, [R1]+41s, [R2]+41s 
D/Picasso: Hunter      executing    [R0]+41s, [R1]+41s, [R2]+41s 
D/Picasso: Dispatcher  batched      [R0]+41s, [R1]+41s, [R2]+41s for error
D/Picasso: Dispatcher  delivered    [R0]+42s, [R1]+42s, [R2]+42s 
D/Picasso: Main        errored      [R0]+42s 
D/Picasso: Main        errored      [R1]+42s 
D/Picasso: Main        errored      [R2]+42s 

我认为错误就在这一行:

 W/System.err: remove failed: ENOENT (No such file or directory) : /data/data/com.example.ahmadi.khadamat/cache/picasso-cache/journal.tmp

它适用于所有Android版本,但它不适用于Android 5.1.1(平板电脑)(api 22)

1 个答案:

答案 0 :(得分:1)

添加以下代码:

.memoryPolicy(MemoryPolicy.NO_STORE)
.networkPolicy(NetworkPolicy.NO_STORE)