android - 在android studio中添加库?

标签 android github android-glide

当我想添加这个库

implementation 'com.github.bumptech.glide:glide:4.9.0'

我的 android 出现这个错误:

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.github.bumptech.glide:glide:4.9.0.

这是我的应用模块

apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
    applicationId "com.example.mahdi.chatapp"
    minSdkVersion 16
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.firebase:firebase-auth:16.1.0'
    implementation 'com.google.firebase:firebase-config:16.3.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.google.firebase:firebase-core:16.0.7'
    implementation 'com.google.firebase:firebase-database:16.0.6'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.rengwuxian.materialedittext:library:2.1.4'
    implementation 'de.hdodenhof:circleimageview:3.0.0'
    implementation 'com.github.bumptech.glide:glide:4.9.0'
}

apply plugin: 'com.google.gms.google-services'

最佳答案

你有没有在Gradle文件中加入这段代码

repositories {
  mavenCentral()
  google()
}

关于android - 在android studio中添加库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54918824/

相关文章:

android - 从 sqlite 获取单个条目

android - 如何通过 contacts api 在 android 中设置照片

AndroidX没有找到类“android.support.v4.content.ContextCompat

git - 压缩到只有一个 "proper"提交 github pull 请求

github - 无法从 GitHub API 触发调度

git - 我可以像使用 github 时那样在 git 中创建 "releases"吗?

java - Android,Glide图像加载库: NullPointerException, ProviderInfo

android - 找不到证书链,如何修复并发布到 Google Play 商店?

android - 为什么 Glide 加载的图像在 RecyclerView 中会被降采样到低分辨率?

android - 如何在android wear中加载URL图片?