相关疑难解决方法(0)

Android依赖项对于编译和运行时具有不同的版本

将Android Studio从Canary 3更新为Canary 4后,在构建时抛出以下错误.

Android依赖项'com.android.support:support-support-v4'具有不同版本的编译(25.2.0)和运行时(26.0.0-beta2)类路径.您应该通过DependencyResolution手动设置相同的版本.

我在整个项目中进行了完整的搜索,并且版本25.1.0没有使用.

APP-的build.gradle

android {
compileSdkVersion 26
buildToolsVersion '26.0.0'


defaultConfig {
    applicationId "com.xxx.xxxx"
    minSdkVersion 14
    targetSdkVersion
    versionCode 1
    versionName "1.0"
    multiDexEnabled true

}


buildTypes {
    debug {
        debuggable true
    }
    release {
        debuggable false
        minifyEnabled true
        shrinkResources true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }

    lintOptions {
        abortOnError false
    }

}}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.12'
implementation project(':core')
implementation com.google.android.gms:play-services-gcm:9.0.0'

implementation('com.crashlytics.sdk.android:crashlytics:2.6.5@aar') {
    transitive = true
}
implementation 'com.android.support:multidex:1.0.1'
implementation …
Run Code Online (Sandbox Code Playgroud)

android build.gradle android-gradle-plugin

99
推荐指数
7
解决办法
12万
查看次数

Flutter和AndroidX不兼容如何手动设置依赖项

由于AndroidX不兼容,在编译时出现错误:

Android依赖项“ androidx.vectordrawable:vectordrawable”对于编译(1.0.0)和运行时(1.0.1)类路径具有不同的版本。您应该通过DependencyResolution手动设置相同的版本

以下->这篇帖子<-我向build.gradle添加了一些代码

allprojects {

configurations.all {
    resolutionStrategy.force"androidx.vectordrawable:vectordrawable:1.0.0",
}
repositories {
    google()
    jcenter()
}
Run Code Online (Sandbox Code Playgroud)

下次跑步给了我另一个错误

Android依赖项“ androidx.core:core”对于编译(1.0.0)和运行时(1.0.1)类路径具有不同的版本。您应该通过DependencyResolution手动设置相同的版本

我试图添加这个

“ androidx.vectordrawable:vectordrawable:1.0.0”,“ androidx.core:core:1.0.0”,

但我可能做错了,因为我得到了经典的“意外的bla bla bla”

有什么建议吗?

提前致谢

[编辑]我试过这个老把戏一样好,但没有工作(也降级包所需HERE

rootProject.allprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'androidx.core') {
                details.useVersion "1.0.1"
            }
            if (details.requested.group == 'androidx.lifecycle') {
                details.useVersion "2.0.0"
            }
            if (details.requested.group == 'androidx.versionedparcelable') {
                details.useVersion "1.0.0"
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

现在返回另一个错误

Android依赖项“ androidx.appcompat:appcompat”对于编译(1.0.0)和运行时(1.0.2)类路径具有不同的版本。您应该通过DependencyResolution手动设置相同的版本

android gradle dart flutter androidx

1
推荐指数
1
解决办法
378
查看次数