【问题标题】:Glide not loading online Images滑翔不加载在线图像
【发布时间】:2020-05-07 04:22:05
【问题描述】:

我在将在线图像加载到 Glide 时遇到问题!我已经尝试过这些代码:

我的build.gradle


apply plugin: 'com.android.application'

    android {
        compileSdkVersion 27
        defaultConfig {
        applicationId "com.devX.meta"
        minSdkVersion 14
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        }
    }

    dependencies {
        compile 'com.android.support:cardview-v7:27.0.0'
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'com.android.support:appcompat-v7:27.0.0'
        // implementation 'com.android.support.constraint:constraint-layout:1.1.3'
        compile 'com.github.bumptech.glide:glide:3.8.0'
        }

注意:我无法更改我的 API 级别

不改变 gradle 的 API 级别如何解决这个问题?

这是我调用的 Glide 代码

MainActivity


Glide.with(this).load("https://animevaya.000webhostapp.com/wp-content/uploads/2020/05/ic_launcher-web.png").placeholder(R.drawable.window).error(R.drawable.bg_white_text_red).into(ImgX);

有什么解决办法吗?

【问题讨论】:

  • 请也提供错误信息,以便我们为您提供帮助
  • 当我打开我的应用程序时没有错误,它首先显示占位符,然后显示错误持有人!我无法理解错误发生在哪里
  • 您的设备 API 级别是多少,我建议您安装较低的设备 android 版本 6.0 或 7.0,如果它显示这意味着您应该配置 network_config,因为您的应用程序目标是 android 28

标签: android networking android-glide


【解决方案1】:

你可以试试最新版本

   implementation 'com.github.bumptech.glide:glide:4.11.0'
   annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0' 

然后

 RequestManager requestManager = Glide.with(this);
 RequestBuilder requestBuilder = requestManager.load("your_url");
 requestBuilder.into(imageViewOBJ);

仅供参考

  1. 您正在使用 OLD compile。移至 implementation
  2. 移至 AndroidX
  3. compileSdkVersion 应该是 29。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-11-05
    • 1970-01-01
    • 2017-07-12
    • 1970-01-01
    • 1970-01-01
    • 2020-05-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多