Gradle Error: "Plugin with id 'dev.flutter.flutter-gradle-plugin' not found" - Flutter

 The error message "Plugin with id 'dev.flutter.flutter-gradle-plugin' not found" typically indicates that Gradle is unable to locate the Flutter Gradle plugin. To resolve this issue, you can follow these steps:


1. Make sure your Flutter project is set up correctly and Flutter is installed. You can check this by running `flutter doctor` in your project directory.


2. Verify your `build.gradle` files:


   - Open the `android/build.gradle` file and ensure that the Flutter Gradle plugin is included in the `dependencies` section of the `buildscript` block. It should look something like this:


     ```gradle

     buildscript {

         repositories {

             google()

             jcenter()

         }


         dependencies {

             classpath 'com.android.tools.build:gradle:xxx' // Use the appropriate version

             classpath 'dev.flutter:flutter-gradle-plugin:xxx' // Use the appropriate version

         }

     }

     ```


   - Open the `android/app/build.gradle` file and ensure that the Flutter Gradle plugin is applied in the `dependencies` block. It should look like this:


     ```gradle

     apply plugin: 'com.android.application'

     apply plugin: 'kotlin-android'

     apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" // Ensure this line is present

     ```


3. If the plugin is missing, you can try to add it manually by editing the `build.gradle` files as described above. Make sure to use the correct version numbers.


4. After making these changes, sync your project with Gradle by clicking "Sync Project with Gradle Files" in Android Studio, or by running `flutter pub get` and then `flutter pub upgrade` in your terminal.


5. Finally, clean and rebuild your project. In Android Studio, you can do this by selecting "Build" -> "Clean Project" and then "Build" -> "Rebuild Project."


If you've followed these steps and still encounter the error, double-check your Gradle files and the Flutter environment setup. You may also want to ensure you're using the correct version of the Flutter Gradle plugin by referring to the official Flutter documentation or the Flutter GitHub repository.

Comments

Popular posts from this blog

bad character U+002D '-' in my helm template

GitLab pipeline stopped working with invalid yaml error

How do I add a printer in OpenSUSE which is being shared by a CUPS print server?