由于快照依赖性,Gradle Sync失败(Android Studio)

时间:2018-12-07 11:12:02

标签: java android android-studio gradle

我已经有很长时间了。我在Android Studio中的Gradle同步始终失败。似乎我混淆了依赖性... 错误消息始终是相同的:

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.vt:cort-commons:0.0.1-SNAPSHOT.
Open File
Show Details


Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.vt:cort-ws-model:0.0.1-SNAPSHOT.
Open File
Show Details

这是带有标记依赖性的构建包的样子

enter image description here

红色标记线表示混合的依赖项(28.0.028.0.0-rc2),其他标记为绿色的行表示存在可用的较新版本。作为SDK,我已经安装了28.0.028.0.0-rc227.0.3。如果我卸载27.0.3,则会出现错误,提示消息27.0.3是必需的...(而且我也不知道为什么)

这是我的build.gradle文件...

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.25.4'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}

apply plugin: 'maven'

android {
    compileSdkVersion 28
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        applicationId "com.vt.cort"
        minSdkVersion 23
        targetSdkVersion 28
        versionCode 5
        versionName "5.0"
        multiDexEnabled true
    }

    signingConfigs {
        debug {
            storeFile file(System.getProperty("user.home") + "/.android/debug.keystore")
            storePassword 'android'
        }
        release {
            storeFile file("../cort.keystore")
            storePassword 'xxx'
            keyAlias 'xxx
            keyPassword 'xxx'
        }
        playstore {
            storeFile file("../cort-play-upload.keystore")
            storePassword 'xxx'
            keyAlias 'xxx'
            keyPassword 'xxx'
        }
    }

    buildTypes {
        debug {
            debuggable true
            minifyEnabled false
            shrinkResources false
            //proguard-android.txt is present in the platform sdk
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.debug
        }
        release {
            debuggable false
            minifyEnabled true
            shrinkResources true
            //proguard-android.txt is present in the platform sdk
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }

        playstore {
            debuggable false
            minifyEnabled true
            shrinkResources true
            //proguard-android.txt is present in the platform sdk
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.playstore
        }
    }

    lintOptions {
        abortOnError false
    }
}

dependencies {
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:animated-vector-drawable:28.0.0'
    implementation 'com.android.support:exifinterface:28.0.0'
    implementation 'com.android.support:customtabs:28.0.0'

    implementation 'com.android.support:mediarouter-v7:28.0.0'
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    implementation 'com.google.firebase:firebase-core:16.0.6'
    implementation 'com.google.firebase:firebase-auth:16.0.5'
    implementation 'com.google.firebase:firebase-perf:16.2.2'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'org.jetbrains:annotations:16.0.2'
    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.11.0'
    implementation 'com.squareup.okhttp3:okhttp:3.11.0'
    implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.11.0'
    implementation 'com.squareup:otto:1.3.8'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'com.github.japgolly.android:svg-android:2.0.6'
    //No updates available on this since Mar, 2014
    implementation 'com.getbase:floatingactionbutton:1.10.1'
    // No updates are available on this since Oct, 2015
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.7'
    implementation 'com.facebook.android:facebook-android-sdk:4.38.0'
    implementation 'com.vt:cort-commons:0.0.1-SNAPSHOT@jar'
    implementation 'com.vt:cort-ws-model:0.0.1-SNAPSHOT@jar'
}

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

artifacts {
    archives file : file('build/outputs/apk/release/app-release.apk')
}

uploadArchives {
    repositories {
        mavenDeployer {
            pom.groupId = "com.vt.cort"
            pom.artifactId = 'cort'
            pom.version  = '1.0-SNAPSHOT'
            repository(url: "http://localhost:4080/nexus/content/repositories/elm-repository") {
                authentication(userName: "admin1", password: "admin123")
            }
        }
    }
}

1 个答案:

答案 0 :(得分:2)

您曾经使用28.0.0-rc02的某个地方,而您曾经使用28.0.0的某个地方。这是错误的方法!

尝试用28.0.0-rc02更改所有28.0.3

它警告您使用最新版本。