android - 无法解决Android Studio中的依赖关系

标签 android android-studio gradle android-gradle-plugin android-studio-3.2

我的.android依赖项都无法解析。

例子:

无法解决:com.android.support:appcompat-v7:28.1.0
显示在文件中
在项目结构对话框中显示

无法解决:com.android.support:support-v4:28.1.0
显示在文件中
在项目结构对话框中显示

我的gradle版本是4.6,我刚刚更新到了最新的android studio版本3.2.1。

我的基于项目的gradle如下所示:

buildscript {
    repositories {
        jcenter()
     mavenCentral()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:4.0.1'

    }
}

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

        google()
    }
}

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

和我基于应用程序的gradle文件:
apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'

    defaultConfig {
        applicationId "com.example.sanchez.worldgramproject"
        minSdkVersion 21
        targetSdkVersion 28
        multiDexEnabled true
        versionCode 0
        versionName "0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            debuggable true
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.github.madrapps:pikolo:1.1.6'
    implementation 'com.android.support:design:28.1.0'
    implementation 'com.firebaseui:firebase-ui-database:4.2.0'
    implementation 'com.github.bumptech.glide:glide:3.8.0'
    implementation 'com.firebaseui:firebase-ui-storage:2.3.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    implementation 'com.android.support:appcompat-v7:28.1.0'
    implementation 'com.android.support:cardview-v7:28.1.0'
    implementation 'com.android.support:recyclerview-v7:28.1.0'
    implementation 'com.jakewharton:butterknife:8.8.1'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.6'
    implementation 'de.hdodenhof:circleimageview:2.2.0'
    implementation 'com.android.support:support-v4:28.1.0'
    implementation 'com.android.support:exifinterface:28.1.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.google.firebase:firebase-auth:16.0.5'
    implementation 'com.google.firebase:firebase-database:16.0.4'
    implementation 'com.google.firebase:firebase-storage:16.0.4'
}

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

最佳答案

由于版本缺失与buildTool匹配,因此更改了这样的错误依赖关系
更改BuildTollVersion

 buildToolsVersion '28.1.3'

(如果不起作用)更改
com.android.support:appcompat-v7:28.0.0
com.android.support:support-v4:28.0.0 

并且您需要将所有28.1 ...版本更改为28.0 ...

关于android - 无法解决Android Studio中的依赖关系,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53021529/

相关文章:

git - 如何通过groovy执行shell命令

java - Gradle + Eclipse:在新项目中使用现有项目中的类

java - 解析二进制数据

android - 有没有办法让 TextView 使用 Spinner 样式?

android - 更新搞砸了 Android Studio 环境

windows - 在不同的 Windows 和 Mac 机器之间共享 Android Studio 项目

android - 将外部库添加到android studio 0.5.1项目中

android - ViewFlipper 的插值器

android - 在 EditText 中输入文本时 ActionBar 展开

android - Android Studio错误: java.net.SocketException: Connection reset