Получение «Не удается найти версию« com.android.support:support-annotations », которая удовлетворяет ограничениям версии» после обновления Android Studio - PullRequest
0 голосов
/ 06 февраля 2019

После обновления до последней версии я больше не могу собрать APK, и я не могу понять ошибку gradle.

Это конфигурация модуля:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.myapp.mymodule"
        minSdkVersion 17
        targetSdkVersion 26
        versionCode 31
        versionName "2.07"
        project.archivesBaseName = "app-name_v" + defaultConfig.versionName
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility = '1.8'
        targetCompatibility = '1.8'
    }

}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    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 'ch.acra:acra:4.9.2'

}

Это ошибка, которая отображается на экране сборки:

Cannot find a version of 'com.android.support:support-annotations' that satisfies the version constraints: 
   Dependency path 'my-project:my-module:unspecified' --> 'com.android.support.test:runner:1.0.2' --> 'com.android.support:support-annotations:27.1.1'
   Dependency path 'my-project:my-module:unspecified' --> 'com.android.support:appcompat-v7:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
   Dependency path 'my-project:my-module:unspecified' --> 'ch.acra:acra:4.9.2' --> 'com.android.support:support-annotations:24.1.1'
   Dependency path 'my-project:my-module:unspecified' --> 'com.android.support.test:runner:1.0.2' --> 'com.android.support.test:monitor:1.0.2' --> 'com.android.support:support-annotations:27.1.1'
   Dependency path 'my-project:my-module:unspecified' --> 'com.android.support.test.espresso:espresso-core:3.0.2' --> 'com.android.support.test:runner:1.0.2' --> 'com.android.support:support-annotations:27.1.1'
   Dependency path 'my-project:my-module:unspecified' --> 'com.android.support:appcompat-v7:26.1.0' --> 'com.android.support:support-vector-drawable:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
   Dependency path 'my-project:my-module:unspecified' --> 'com.android.support:design:26.1.0' --> 'com.android.support:appcompat-v7:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
   Dependency path 'my-project:my-module:unspecified' --> 'com.android.support:design:26.1.0' --> 'com.android.support:recyclerview-v7:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
   Dependency path 'my-project:my-module:unspecified' --> 'com.android.support:design:26.1.0' --> 'com.android.support:transition:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
   Dependency path 'my-project:my-module:unspecified' --> 'com.android.support:appcompat-v7:26.1.0' --> 'com.android.support:support-v4:26.1.0' --> 'com.android.support:support-compat:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
   Dependency path 'my-project:my-module:unspecified' --> 'com.android.support:appcompat-v7:26.1.0' --> 'com.android.support:support-v4:26.1.0' --> 'com.android.support:support-media-compat:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
   Dependency path 'my-project:my-module:unspecified' --> 'com.android.support:appcompat-v7:26.1.0' --> 'com.android.support:support-v4:26.1.0' --> 'com.android.support:support-core-utils:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
   Dependency path 'my-project:my-module:unspecified' --> 'com.android.support:appcompat-v7:26.1.0' --> 'com.android.support:support-v4:26.1.0' --> 'com.android.support:support-core-ui:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
   Constraint path 'my-project:my-module:unspecified' --> 'com.android.support:support-annotations' strictly '26.1.0' because of the following reason: debugRuntimeClasspath uses version 26.1.0
   Constraint path 'my-project:my-module:unspecified' --> 'com.android.support:support-annotations' strictly '26.1.0' because of the following reason: debugRuntimeClasspath uses version 26.1.0
   Constraint path 'my-project:my-module:unspecified' --> 'com.android.support:support-annotations' strictly '26.1.0' because of the following reason: debugRuntimeClasspath uses version 26.1.0
   Constraint path 'my-project:my-module:unspecified' --> 'com.android.support:support-annotations' strictly '26.1.0' because of the following reason: debugRuntimeClasspath uses version 26.1.0

Сборка приложения полностью без ошибок, иможет работать на устройствах без проблем.

Я попробовал предложения в: Не могу найти версию 'com.android.support:support-annotations', которая удовлетворяет ограничениям версии но любой из них работал для меня.

Это gradle.config:

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'
    }
}

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

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

1 Ответ

0 голосов
/ 06 февраля 2019

Полагаю, я не обратила должного внимания.В журнале сборки:

   Dependency path 'my-project:my-module:unspecified' --> 'com.android.support.test:runner:1.0.2' --> 'com.android.support.test:monitor:1.0.2' --> 'com.android.support:support-annotations:27.1.1'
   Dependency path 'my-project:my-module:unspecified' --> 'com.android.support.test.espresso:espresso-core:3.0.2' --> 'com.android.support.test:runner:1.0.2' --> 'com.android.support:support-annotations:27.1.1'

TestImplementation использовала его более высокую версию.Я удалил эти зависимости, и теперь сборка верна.Я думаю, что мне нужно установить более низкую версию testImplementation, чтобы вернуть ее в будущем.

...