无法用Picasso从网址加载图片

时间:2016-08-15 13:52:22

标签: android image listview picasso

我使用Picasso将图像下载到我的Android应用程序的列表视图中。 除了在Kitkat环境中运行外,它的工作方式就像魅力一样。

My layout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" 
>
<ImageView
    android:id="@+id/articleimage"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingTop="8dp"
    android:paddingBottom="5dp"
    android:adjustViewBounds="true"
    android:scaleType="centerCrop"
    android:layout_alignParentTop="true"
    />
</RelativeLayout>

我的日志

08-11 06:30:19.406 28898-28898/com.s W/System.err: com.squareup.picasso.Downloader$ResponseException: 404 Not Found
08-11 06:30:19.406 28898-28898/com.s W/System.err:     at com.squareup.picasso.UrlConnectionDownloader.load(UrlConnectionDownloader.java:96)
08-11 06:30:19.406 28898-28898/com.s W/System.err:     at com.squareup.picasso.NetworkRequestHandler.load(NetworkRequestHandler.java:47)
08-11 06:30:19.406 28898-28898/com.s W/System.err:     at com.squareup.picasso.BitmapHunter.hunt(BitmapHunter.java:206)
08-11 06:30:19.406 28898-28898/com.s W/System.err:     at com.squareup.picasso.BitmapHunter.run(BitmapHunter.java:159)
08-11 06:30:19.406 28898-28898/com.s W/System.err:     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
08-11 06:30:19.406 28898-28898/com.s W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
08-11 06:30:19.406 28898-28898/com.s W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
08-11 06:30:19.406 28898-28898/com.s W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
08-11 06:30:19.406 28898-28898/com.s W/System.err:     at java.lang.Thread.run(Thread.java:841)
08-11 06:30:19.406 28898-28898/com.s W/System.err:     at com.squareup.picasso.Utils$PicassoThread.run(Utils.java:411)

我的配置

compileSdkVersion 23
buildToolsVersion '23.0.0'

compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:design:23.0.0'

使用ImageLoader我在下载图片时出错

 http://url/uploads/Vous-êtes-cerveau-droit-ou-cerveau-gauche-300x160.jpg
08-15 10:05:09.042 1915-2474/com.s W/System.err: java.io.FileNotFoundException: http://url/uploads/Vous-êtes-cerveau-droit-ou-cerveau-gauche-300x160.jpg
08-15 10:05:09.042 1915-2474/com.s W/System.err:     at com.android.okhttp.internal.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:186)
08-15 10:05:09.042 1915-2474/com.s W/System.err:     at java.net.URL.openStream(URL.java:470)
08-15 10:05:09.042 1915-2474/com.s W/System.err:     at com.s.ArticleActivity$DownloadImageTask.doInBackground(ArticleActivity.java:446)
08-15 10:05:09.042 1915-2474/com.s W/System.err:     at com.s.ArticleActivity$DownloadImageTask.doInBackground(ArticleActivity.java:436)
08-15 10:05:09.042 1915-2474/com.s W/System.err:     at android.os.AsyncTask$2.call(AsyncTask.java:288)
08-15 10:05:09.042 1915-2474/com.s W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
08-15 10:05:09.042 1915-2474/com.s W/System.err:     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
08-15 10:05:09.042 1915-2474/com.s W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
08-15 10:05:09.042 1915-2474/com.s W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
08-15 10:05:09.042 1915-2474/com.s W/System.err:     at java.lang.Thread.run(Thread.java:841)

0 个答案:

没有答案