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

时间:2018-10-27 11:39:05

标签: android android-studio gradle android-gradle 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'

2 个答案:

答案 0 :(得分:0)

由于版本缺失与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 ...

答案 1 :(得分:0)

删除buildToolsVersion '28.0.3',并将28.0.0用于所有支持库。