You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flutter升级后Gradle assembleDebug任务失败求助

Troubleshooting the registerResGeneratingTask is deprecated Error After Flutter Upgrade

Hey there, let’s walk through actionable steps to fix this issue—you’re right to suspect outdated third-party plugins or AndroidX conflicts, since this error almost always stems from those areas post-Flutter upgrade.

1. Update All Third-Party Plugins First

Outdated plugins are the #1 culprit here, especially Firebase-related ones like cloud_firestore.

  • Open your pubspec.yaml file and cross-check every plugin’s version against their latest stable releases. For Firebase packages, make sure you’re using versions compatible with your updated Flutter.
  • Run flutter pub upgrade to pull the latest versions, then flutter pub get to sync dependencies.
  • Follow up with flutter clean to wipe old build artifacts, then try rebuilding the app.

2. Double-Check AndroidX Configuration

Flutter upgrades often require full AndroidX compatibility, and missing setup here can clash with old plugins:

  • Open android/gradle.properties and confirm these lines are present (add them if missing):
    android.useAndroidX=true
    android.enableJetifier=true
    
  • Jetifier automatically converts old support library dependencies to AndroidX, which can resolve hidden conflicts from outdated plugins. After updating this file, run flutter clean and rebuild.

3. Align Gradle Versions with Your Flutter Update

New Flutter versions often require newer Gradle tooling. Mismatched versions can trigger deprecated method warnings:

  • Open android/build.gradle and update the Android Gradle plugin version to match Flutter’s recommended version (check Flutter’s docs for your specific release). For example:
    dependencies {
        classpath 'com.android.tools.build:gradle:7.4.2' // Use latest compatible version
        // Keep your Firebase Gradle plugin version aligned with Firebase SDKs too
    }
    
  • Update the Gradle wrapper in android/gradle/wrapper/gradle-wrapper.properties:
    distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
    
  • Make sure these versions are compatible with each other (the Gradle plugin and wrapper versions should pair correctly).

4. Pinpoint the Exact Offending Plugin

If updating plugins doesn’t work, find out which one is calling the deprecated method:

  • Run flutter run -v to get verbose build logs. Scan the output for the full context around the registerResGeneratingTask warning—this will show which plugin’s code is triggering it.
  • Once you identify the plugin, check its GitHub issues to see if a fix is already available (maybe a beta version resolves the problem). If no fix exists, you might need to temporarily roll back the plugin to a version that works with your Flutter setup, or look for a alternative package.

5. Do a Full Clean Rebuild

Cached build files can hold onto old conflicts even after updates:

  • Run flutter clean to delete all build artifacts.
  • Delete the .gradle folder inside your project’s android directory.
  • Run flutter pub get again, then launch the app with flutter run.

内容的提问来源于stack exchange,提问作者Jérémy

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.13 08:29:20