首页 > 解决方案 > 无法解析 com.github

问题描述

我正在尝试在 android studio 3.0.1 中构建我的 android 项目,但在它完全加载之前它向我显示错误无法解析 com.github并且当我单击在文件中显示时光标指向我的 实现 'com.github.clans:fab :1.6.2' build.gradle(Module:app) 中的这个依赖

这是我的 build.gradle(模块应用程序)。

    apply plugin: 'com.android.application'
    apply plugin: 'com.google.firebase.firebase-perf'
    apply plugin: 'io.fabric'

    android {
        compileSdkVersion 28
        defaultConfig {
            applicationId "xxx.xx.xxxx"
            minSdkVersion 21
            targetSdkVersion 28
            versionCode 5
            versionName "2.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
            multiDexEnabled true
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }
allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
    }
}
    dependencies {
        implementation fileTree(include: ['*.jar'], dir: 'libs')
        implementation 'com.android.support:appcompat-v7:28.0.0'
        implementation 'com.android.support.constraint:constraint-layout:1.1.2'
        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.github.clans:fab:1.6.2'
        implementation 'com.android.volley:volley:1.1.0'
        implementation('es.voghdev.pdfviewpager:library:1.0.4') {
            exclude group: 'com.android.support'
            exclude module: 'appcompat-v7'
            exclude module: 'support-v4'
        }
        implementation 'com.github.rieved :glide:4.8.0'
        annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
        //implementation 'com.github.bumptech.glide:okhttp3-integration:1.4.0@aar'
        implementation 'com.google.android.ads.consent:consent-library:1.0.6'
        implementation 'com.android.support:design:28.0.0'
        implementation 'de.hdodenhof:circleimageview:2.2.0'
        implementation 'com.google.android.gms:play-services-ads:16.0.0'
        implementation 'com.android.support:customtabs:28.0.0'
        implementation 'com.android.support:multidex:1.0.0'
        implementation 'com.android.support:recyclerview-v7:28.0.0'
        implementation 'org.jsoup:jsoup:1.8.3'
        implementation 'com.github.darsh2:MultipleImageSelect:v0.0.4'
        api 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
        implementation 'com.android.support:cardview-v7:28.0.0'
        implementation 'com.google.firebase:firebase-core:16.0.6'
        implementation 'com.google.firebase:firebase-messaging:17.3.4'
        implementation 'com.github.florent37:tutoshowcase:1.0.1'
        implementation 'com.github.deano2390:MaterialShowcaseView:1.2.0'
        implementation 'com.linsea:universalvideoview:1.1.0@aar'    
        implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
        implementation 'com.google.firebase:firebase-perf:16.2.3'
    }

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

我在网上冲浪,我尝试了不同的解决方案,比如添加

allprojects {
    repositories {
        google()
        jcenter()
    }
}

这是我的 build.gradle (gradle.properties)

    // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        mavenCentral()
        google()
        jcenter()
        maven {
            url 'https://maven.fabric.io/public'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:4.2.0'
        classpath 'com.google.gms:google-services:4.2.0'
        classpath 'io.fabric.tools:gradle:1.26.1'
        classpath 'com.google.firebase:firebase-plugins:1.1.5'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url "https://jitpack.io"
        }
        maven{
            url "https://maven.google.com"
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

但这不起作用。

标签: androidandroid-gradle-pluginbuild.gradle

解决方案


最后,我得到了这个问题。主要问题是你在这一行的依赖实现中有一个空间

implementation 'com.github.rieved :glide:4.8.0'

从依赖项中删除此行并添加此行以使用 Glide

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

希望这能解决您的问题。


推荐阅读