Ramin JAN
Ramin JAN

Reputation: 1

Plugin [id: 'com.android.application'] not found in Flutter project with build.gradle.kts (Even After Changing Versions and Settings)

Hello everyone,

I’m facing an issue with my Flutter project, which uses Gradle with Kotlin DSL (build.gradle.kts). When I try to build the project, I keep getting the following error:

Plugin [id: 'com.android.application'] was not found in any of the following sources:

What I’ve tried so far:

plugins {
    id("com.android.application")
    id("kotlin-android")
    id("dev.flutter.flutter-gradle-plugin")
}

System setup:

Question:

Has anyone worked with Flutter projects using Kotlin DSL for Gradle?
Is there something I might be missing or misconfiguring?
I’d really appreciate any insights or suggestions!

PS D:\\afghan\\android\> flutter doctor
Flutter assets will be downloaded from https://storage.flutter_io.cn. Make sure you trust this source!
Doctor summary (to see all details, run flutter doctor ):
√ Flutter (Channel stable, 3.29.0, on Microsoft Windows \[Version 10.0.26100.3194\], locale en-US)
√ Windows Version (11 Pro 64-bit, 24H2, 2009)
√ Android toolchain - develop for Android devices (Android SDK version 35.0.1)
√ Chrome - develop for the web
√ Visual Studio - develop Windows apps (Visual Studio Community 2022 17.12.4)
 √ Android Studio (version 2024.2)
√ VS Code (version 1.97.2)
√ Connected device (3 ava

PS D:\\afghan\> flutter build apk
Flutter assets will be downloaded from https://storage.flutter_io.cn. Make sure you trust this source!

FAILURE: Build failed with an exception.

* Where:
  Build file 'D:\\afghan\\android\\app\\build.gradle.kts' line: 4

* What went wrong:
  Plugin \[id: 'com.android.application'\] was not found in any of the following sources:


- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (plugin dependency must include a version number for this source)


* 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 13s
Running Gradle task 'assembleRelease'...                           14.2s
Gradle task assembleRelease failed with exit code 1
PS D:\\afghan\> cd android
PS D:\\afghan\\android\> .\\gradlew clean
Starting a Gradle Daemon, 2 incompatible and 2 stopped Daemons could not be reused, use --status for details

> Configure project :gradle
> WARNING: Unsupported Kotlin plugin version.
> The `embedded-kotlin` and `kotlin-dsl` plugins rely on features of Kotlin `1.9.10` that might work differently than in the requested version `1.9.20`.

FAILURE: Build failed with an exception.

* Where:
  Build file 'D:\\afghan\\android\\app\\build.gradle.kts' line: 4

* What went wrong:
  Plugin \[id: 'com.android.application'\] was not found in any of the following sources:


- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (plugin dependency must include a version number for this source)


* 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 9s

Upvotes: -3

Views: 48

Answers (0)

Related Questions