gpt4 book ai didi

android - 将配置的依赖关系包含在Android Studio 3.2.1的依赖关系解析后,无法更改

转载 作者:行者123 更新时间:2023-12-03 04:18:18 26 4
gpt4 key购买 nike

更新到

    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"
}
}

最佳答案

将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"
}
}

应用程序/build.gradle:
buildToolsVersion = "28.0.3"
supportLibVer = '28.0.0'

但是,在Android Studio中添加库或类路径时,建议不要使用 +。就像我说的,最好包含最新版本。

因此,而不是 io.fabric.tools:gradle:1.+,请使用最新版本: 1.21.5

关于android - 将配置的依赖关系包含在Android Studio 3.2.1的依赖关系解析后,无法更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52812273/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com