使用FVM将Flutter项目从3.24.1版本升级到3.27.0时如何解决Gradle和兼容性问题?

问题描述 投票:0回答:1

我正在使用 FVM(Flutter 版本管理)将我的 Flutter 项目从版本 3.24.1 升级到 3.27.0。切换到新版本并运行项目后,遇到以下问题:

错误消息:

Execution failed for task ':app:processDevelopmentDebugResources'

迄今为止采取的步骤:

  1. 使用

    fvm use 3.27.0
    更新了 Flutter 版本。

  2. pubspec.yaml
    中的依赖项更新到最新版本。

  3. flutter pub get
    flutter clean

  4. 尝试再次运行项目,但遇到 Gradle 错误。

相关代码及配置:

android/build.gradle

梯度

buildscript {
    ext.kotlin_version = '1.7.10'
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.2.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

android/app/build.gradle

梯度

android {
    compileSdkVersion 33
    // other configurations...
}

错误日志:

* What went wrong:
Execution failed for task ':processDevelopmentDebugResources'.
> Could not resolve all files for configuration ':path_provider:detachedConfiguration1'.
   > Could not find com.android.tools.build:gradle:7.2.0.
     Searched in the following locations:
 
flutter build.gradle version dependency-management flutter-upgrade
1个回答
0
投票

打开

Preferences/Flutter
提供当前项目Flutter SDK路径作为你的fvm默认路径。

/Users/fvm/default
- 这是我的。

找到你的fvm文件夹,只需复制默认路径并将其粘贴到

Flutter SDK path
中。如果一切都正确完成,您将在路径下方看到以下内容:

Flutter 3.27.1 • channel stable • https://github.com/flutter/flutter.git

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.