【问题标题】:Unable to load images on some mobiles with picasso android studio无法在使用 picasso android studio 的某些手机上加载图像
【发布时间】:2018-08-09 13:23:17
【问题描述】:

我已经构建了一个不会在某些手机上加载图像的 android 应用程序,但在某些手机上可以正确加载图像。 我尝试在我的手机上使用 android 6.0 和一些具有高 api 的设备并且可以正常工作,但是在一些具有低 api 的设备中,这样的 4.1.1 不起作用并显示错误图像。

Picasso.with(getApplicationContext()).load(imageurl).fit().error(R.drawable.emptyimage).into(logoimg);

我在 android studio 中看到了 logcat,看到了这个日志。

D/dalvikvm: GC_FOR_ALLOC freed 4592K, 43% free 16403K/28487K, paused 5ms, total 6ms
D/dalvikvm: GC_FOR_ALLOC freed 18K, 36% free 18260K/28487K, paused 9ms, total 9ms
I/dalvikvm-heap: Grow heap (frag case) to 21.982MB for 4320012-byte allocation
D/dalvikvm: GC_CONCURRENT freed <1K, 22% free 22478K/28487K, paused 11ms+0ms, total 16ms
W/EGL_genymotion: eglSurfaceAttrib not implemented
D/Picasso: Main        created      [R7] Request{http://89.163.252.47/uploads/Ad_None/bf00eb37-b9b6-4348-a995-1ef884c358f8.jpg resize(454,375)}
D/Picasso: Dispatcher  enqueued     [R7]+5ms 
D/Picasso: Hunter      executing    [R7]+10ms 
D/Picasso: Dispatcher  retrying     [R7]+15s 
D/Picasso: Hunter      executing    [R7]+15s 
D/skia: --- decoder->decode returned false
D/Picasso: Dispatcher  retrying     [R7]+16s 
D/Picasso: Hunter      executing    [R7]+16s 
D/Picasso: Dispatcher  batched      [R7]+16s for error
D/Picasso: Main        errored      [R7]+17s 
D/Picasso: Dispatcher  delivered    [R7]+17s 

从位图使用,不幸的是在 logcat 中看到了这个错误。

D/skia: --- decoder->decode returned false

【问题讨论】:

    标签: android picasso


    【解决方案1】:

    只需使用 Glide 代替 Picasso,它适用于低 API 设备。

    1 .在 gradle 中添加依赖为

    dependencies {
      implementation 'com.github.bumptech.glide:glide:4.7.1'
    }
    

    2。在你想使用的地方写下这一行

      Glide.with(Context).load(imgUrl)
            .apply(new RequestOptions().override(200, 100)).into(imageView);
    

    【讨论】:

    • 同样的问题-_-
    猜你喜欢
    • 2019-08-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-18
    • 2020-03-18
    • 2020-01-09
    • 1970-01-01
    相关资源
    最近更新 更多