【问题标题】:ImageLoader UIL doesn't support scheme(protocol)ImageLoader UIL 不支持方案(协议)
【发布时间】:2016-08-01 04:42:33
【问题描述】:

我在我的 android 应用程序中使用 universal-image-loader-1.9.5.jar。我正在从我的服务器加载图像。但这让我异常。以下是堆栈跟踪。

04-11 12:02:29.410: E/ImageLoader(10672): UIL doesn't support scheme(protocol) by default [ http://104.238.81.220:8080/locator_userimages/+91 98686 33929.jpg]. You should implement this support yourself (BaseImageDownloader.getStreamFromOtherSource(...))

我知道有一些 UIL 支持的预定义 url 格式。

https://github.com/nostra13/Android-Universal-Image-Loader#acceptable-uris-examples

但 UIL 从我的本地服务器获取同一个人的图像,即 http://192.168.1.12:8080/locator_userimages/+91 98686 33929.jpg

下面是设置图片加载器实例的代码。

imageLoader = ImageLoader.getInstance();
        StorageUtils.getCacheDirectory(this);
        imageLoader = ImageLoader.getInstance();
        defaultOptions = new DisplayImageOptions.Builder().cacheOnDisk(true)
                .cacheInMemory(true).imageScaleType(ImageScaleType.EXACTLY)
                .showImageOnLoading(R.drawable.member_icon)
                .showImageOnFail(R.drawable.member_icon)
                .displayer(new FadeInBitmapDisplayer(50)).build();
        config = new ImageLoaderConfiguration.Builder(getApplicationContext())
                .defaultDisplayImageOptions(defaultOptions)
                .memoryCache(new WeakMemoryCache())
                .diskCacheSize(100 * 1024 * 1024).build();
        imageLoader.init(config);

我用这个来加载图片。

ivUserImage = (RoundedImageView) layout.findViewById(R.id.profile_pic);
imageLoader.displayImage(imagePath, ivUserImage, imageOptions);

我的问题是,为什么 UIL 从我的本地服务器获取相同的图像,而不是从远程服务器获取?

我这里有什么遗漏吗?

请帮忙。

【问题讨论】:

    标签: android universal-image-loader


    【解决方案1】:

    我知道你已经知道了,但是我面前有一条错误消息,我可以看到 [] 内没有空格,你的问题是 URL 的开头有一个空格,所以你应该使用 .trim() 方法

    [ http://104.238.81.220:8080/locator_userimages/+91 98686 33929.jpg]
    

    应该是

    [http://104.238.81.220:8080/locator_userimages/+91 98686 33929.jpg]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-07-03
      • 1970-01-01
      • 1970-01-01
      • 2013-09-25
      • 2018-06-29
      • 1970-01-01
      • 1970-01-01
      • 2014-02-09
      相关资源
      最近更新 更多