依赖'android.arch.lifecycle:runtime'对于Flutter中的类路径具有不同的版本

时间:2018-12-26 11:10:22

标签: android flutter

我通过执行以下两个命令来更新我的Flutter ios Pod

cd iOS pod更新-详细 在此之后,我在android中出现以下错误

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:preDebugBuild'.
> Android dependency 'android.arch.lifecycle:runtime' has different version             
for the compile (1.0.0) and runtime (1.1.0) classpath. You should manually set the same version via DependencyResolution

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 0s

我尝试将pubspec.yaml文件中的flutter版本默认更改为

version: 1.1.0+1   

2 个答案:

答案 0 :(得分:2)

使用Firebase并定位API级别26(Android Oreo)可能会发生这种情况

将此内容添加到 saveImage = async filePath => { try { // set new image name and filepath const newImageName = `${moment().format("DDMMYY_HHmmSSS")}.jpg`; const newFilepath = `${dirPicutures}/${newImageName}`; // move and save image to new filepath const imageMoved = await this.moveAttachment(filePath, newFilepath).then( imageMoved => { if (imageMoved) { return RNFS.scanFile(newFilepath); } else { return false; } } ); console.log("image moved", imageMoved); } catch (error) { console.log(error); } }; 内的android\build.gradle

buildscript {...}

答案 1 :(得分:1)

我遇到了同样的问题,我解决了推杆问题:

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

在android> build.gradle文件结尾

我希望这对您有用。