【问题标题】:Add library in android studio?在android studio中添加库?
【发布时间】:2019-07-21 23:06:50
【问题描述】:

当我想添加这个库时:

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'

【问题讨论】:

    标签: android github android-glide


    【解决方案1】:

    你是否在 Gradle 文件中添加了这段代码

    repositories {
      mavenCentral()
      google()
    }
    

    【讨论】:

    • 在哪个 gradle 文件中。在项目 gradle 或应用程序 gradle 中
    【解决方案2】:

    使用最新版本的滑翔,即高于版本 4, 您必须添加一个额外的依赖项(glide 编译器)

    dependencies {
     implementation 'com.github.bumptech.glide:glide:4.9.0'
     annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
    }
    

    在仓库中你必须添加

    repositories {
      mavenCentral()
      google()
    }
    

    参考:https://github.com/bumptech/glide

    【讨论】:

      【解决方案3】:

      你还没有添加注解处理器

      repositories {
      mavenCentral()
      maven { url 'https://maven.google.com' }
      }
      
      dependencies {
      compile 'com.github.bumptech.glide:glide:4.9.0'
      annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
      }
      

      这是 Glide 文档中给出的下载 glide 的代码。见此链接:http://bumptech.github.io/glide/doc/download-setup.html#gradle

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-10-11
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多