Невозможно изменить зависимости конфигурации после ее включения в разрешение зависимостей в Android Studio 3.2.1 - PullRequest
0 голосов
/ 15 октября 2018

После обновления до

    Android Studio 3.2.1
    Build #AI-181.5540.7.32.5056338, built on October 9, 2018
    JRE: 1.8.0_152-release-1136-b06 amd64
    JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
    Windows 7 6.1

Произошла ошибка:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Cannot change dependencies of configuration ':app:qaCompile' after it has been included in dependency resolution.

build.gradle

apply plugin: 'kotlin'
apply plugin: 'base'
apply plugin: 'maven'
buildscript {
    ext.kotlin_version = '1.2.71'
    repositories {
        google()
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
        //region realm
        maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local' }
        //endregion
    }
    dependencies {
        //region google()
        classpath 'com.android.tools.build:gradle:3.1.4'
        //endregion
        //region jcenter()
        classpath 'com.google.gms:google-services:4.0.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.orhanobut.tracklytics:tracklytics-plugin:2.0.0'
        //endregion
        //region maven { url 'https://maven.fabric.io/public' }
        //to check fabric gradle ver
        //https://s3.amazonaws.com/fabric-artifacts/public/io/fabric/tools/gradle/maven-metadata.xml
        classpath 'io.fabric.tools:gradle:1.+'
        //endregion
        //region realm
        classpath "io.realm:realm-gradle-plugin:5.4.2"
        //endregion
    }
}

allprojects {

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

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}

compileKotlin {
    kotlinOptions {
        jvmTarget = "1.8"
    }
}
compileTestKotlin {
    kotlinOptions {
        jvmTarget = "1.8"
    }
}

1 Ответ

0 голосов
/ 15 октября 2018

Может помочь понижение версии kotlin с ext.kotlin_version = '1.2.71' до ext.kotlin_version = '1.2.61'.

Кроме того, обновлены службы Gradle и Google до последней стабильной версии.

Так что в build.gradle:

apply plugin: 'kotlin'
apply plugin: 'base'
apply plugin: 'maven'
buildscript {
    ext.kotlin_version = '1.2.61'
    repositories {
        google()
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
        //region realm
        maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local' }
        //endregion
    }
    dependencies {
        //region google()
        classpath 'com.android.tools.build:gradle:3.2.1'
        //endregion
        //region jcenter()
        classpath 'com.google.gms:google-services:4.1.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.orhanobut.tracklytics:tracklytics-plugin:2.0.0'
        //endregion
        //region maven { url 'https://maven.fabric.io/public' }
        //to check fabric gradle ver
        //https://s3.amazonaws.com/fabric-artifacts/public/io/fabric/tools/gradle/maven-metadata.xml
        classpath 'io.fabric.tools:gradle:1.+'
        //endregion
        //region realm
        classpath "io.realm:realm-gradle-plugin:5.4.2"
        //endregion
    }
}

allprojects {

    repositories {
        mavenLocal()
        google()
        jcenter()
        mavenCentral()


        maven { url "https://jitpack.io" }
    }

}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}

compileKotlin {
    kotlinOptions {
        jvmTarget = "1.8"
    }
}
compileTestKotlin {
    kotlinOptions {
        jvmTarget = "1.8"
    }
}

app / build.gradle:

buildToolsVersion = "28.0.3"
supportLibVer = '28.0.0'

Однако при добавлении библиотеки или пути к классу использование + не рекомендуетсяв Android Studio.Как я уже сказал, лучше включить последнюю версию.

Итак, вместо io.fabric.tools:gradle:1.+ Используйте последнюю версию: 1.21.5.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...