gpt4 book ai didi

android - 如何在Flutter中修复在编译时和运行时具有不同版本的 'android.arch.lifecycle:runtime'?

转载 作者:行者123 更新时间:2023-12-03 05:31:56 25 4
gpt4 key购买 nike

这是我第一次将flutter应用程序与Firebase连接。我已经在 android-> app 目录下添加了 google-services.json 文件,然后

我的应用中的apply plugin: 'com.google.gms.google-services':build.gradle

dependencies {
[...]
classpath 'com.google.gms:google-services:3.2.1'
}

在我的 项目中:按照以下指南https://codelabs.developers.google.com/codelabs/flutter-firebase/#6 android 目录下的build.gradle

当我运行项目时,出现此错误
Launching lib\main.dart on POCO F1 in debug mode...
Initializing gradle...
Resolving dependencies...
Running Gradle task 'assembleDebug'...
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)

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.1) 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 4s
Finished with error: Gradle task assembleDebug failed with exit code 1


在运行 gradle build --stacktrace 后,建议gradle将以下依赖项添加到我的 应用程序中:build.gradle 但它不起作用
dependencies {
implementation("android.arch.lifecycle:runtime:1.1.1")
implementation("android.arch.lifecycle:common:1.1.1")
implementation("android.arch.core:common:1.1.1")
}

最佳答案

我有同样的问题。我通过添加解决

 implementation "android.arch.lifecycle:extensions:1.1.1" 

android> app> build.gradle 文件并将googlet服务升级到 android> build.gradle
版本4.2.0
classpath 'com.google.gms:google-services:4.2.0'

关于android - 如何在Flutter中修复在编译时和运行时具有不同版本的 'android.arch.lifecycle:runtime'?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58858056/

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