Android studio Ladybug 2024.2.1| Plugin [id: 'com.android.application', version: '7.6.3', apply: false] was not found in any of the following sources:

I updated android studio to Android Studio Ladybug 2024.2.1. but none of my projects can run in Android studio Ladybug 2024.2.1. I ended up getting this error.

Here is my gradle:

pluginManagement {
    def flutterSdkPath = {
        def properties = new Properties()
        file("local.properties").withInputStream { properties.load(it) }
        def flutterSdkPath = properties.getProperty("flutter.sdk")
        assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
        return flutterSdkPath
    }()

    includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

    repositories {
        google()
        mavenCentral()
        gradlePluginPortal()
    }
}

plugins {
    id "dev.flutter.flutter-plugin-loader" version "1.0.0"
    id "com.android.application" version "7.6.3" apply false
    id "org.jetbrains.kotlin.android" version "1.7.10" apply false
}

include ":app"

The issue you’re encountering in Android Studio Ladybug 2024.2.1 might be related to compatibility problems with your gradle configuration and the new version of Android Studio. Here are a few steps to troubleshoot and resolve the error:

1. Check Compatibility with Android Gradle Plugin Version:

  • The version of the Android Gradle Plugin (com.android.application) you’re using is 7.6.3. Ensure that it’s compatible with Android Studio Ladybug 2024.2.1.
  • You might need to upgrade it to a newer version, especially if the version 7.6.3 does not support the latest updates in Android Studio.

You can try updating the plugin to the latest version:

plugins {
    id "com.android.application" version "8.0.0" apply false
    id "org.jetbrains.kotlin.android" version "1.8.20" apply false
}

Then sync your project again.

2. Update Kotlin Plugin Version:

You are using Kotlin version 1.7.10, which might be incompatible with Android Studio Ladybug. Try updating Kotlin to a more recent version:

plugins {
    id "org.jetbrains.kotlin.android" version "1.9.0" apply false
}

Make sure the version of Kotlin you’re using is compatible with the Android Gradle plugin and Android Studio.

3. Check flutter-plugin-loader Compatibility:

The flutter-plugin-loader might also have compatibility issues with the new version of Android Studio. Check for any updates to this plugin and update it if necessary.

If you’re unsure whether it’s up to date, search for the latest version or visit the official Flutter GitHub repository.

4. Ensure local.properties is Set Correctly:

Make sure your local.properties file correctly points to your Flutter SDK. If this file isn’t set up correctly, you could encounter issues like SDK not being found. Verify that the path to your Flutter SDK is correct.

Example of local.properties:

flutter.sdk=/path/to/flutter/sdk
sdk.dir=/path/to/android/sdk

5. Clean and Rebuild the Project:

After making the above changes, try cleaning and rebuilding the project. You can do this by running the following commands:

  • Clean: ./gradlew clean
  • Rebuild: ./gradlew build

Alternatively, use the “Clean Project” and “Rebuild Project” options from the “Build” menu in Android Studio.

6. Check Android Studio Logs:

  • Open View > Tool Windows > Build to check the build logs and pinpoint the exact error that’s preventing the project from running.
  • Check for dependency conflicts, build errors, or missing SDK paths.

7. Upgrade Gradle Wrapper Version:

Ensure that the gradle-wrapper.properties file uses a version of Gradle that is compatible with Android Studio Ladybug 2024.2.1. For example:

distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip

This ensures the right Gradle version is being used for your project.

Final Words:

  1. Update the Android Gradle Plugin and Kotlin versions.
  2. Check local.properties for proper Flutter SDK paths.
  3. Clean and rebuild your project.
  4. Check the logs for detailed error messages to further pinpoint the issue.

Let me know if the issue persists after these steps, and we can dig deeper!