Flutter Android构建失败

时间:2018-12-16 10:52:02

标签: android gradle build flutter google-cloud-firestore

当我将Cloud_firestore插件添加到我的Flutte项目中时,会出现此错误

Execution failed for task ':app:preDebugBuild'.
> Android dependency 'com.android.support:support-media-compat' has different version for the compile (26.1.0) and runtime (27.1.1) classpath. You should manually set the same version via DependencyResolution

有人可以帮我吗?

2 个答案:

答案 0 :(得分:1)

我遇到了同样的问题,解决方案是添加此块:

resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion "26.1.0"
            }
        }

android / build.gradle 文件

答案 1 :(得分:-1)

在android / build.gradle文件的末尾,添加以下几行:

subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion "26.1.0"
            }
        }
    }
}