Horizon
08/29/2024, 10:16 AMA problem occurred evaluating project ':app'.
> Plugin with id 'com.android.application' not found.
The error line in my app/build.gradle :
apply plugin: 'com.android.application'
In my android/build.gradle, i have:
buildscript {
ext.kotlin_version = '1.7.20'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.4.2'
}
}
In my gradle-wrapper.properties, i have:
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
Any help would be greatly appreciated (Im very new to gradle and mobile developmentVampire
08/29/2024, 12:55 PMandroid/build.gradle, but you try to use it in app/build.gradle. There it thus is not available.
But you should anyway avoid using the discouraged legacy way to apply plugins using apply plugin and instead use the plugins { ... } block, then you also do not need to use the buildscript { ... } block to add plugins to the buildscript classpath.
I also highly recommend switching to Kotlin DSL. By now it is the default DSL, you immediately get type-safe build scripts, actually helpful error messages if you mess up the syntax, and an amazingly better IDE support if you use a good IDE like IntelliJ IDEA or Android Studio.Horizon
08/30/2024, 6:46 PMbuildscript { ... } block to apply plugin and plugins { ... } block, fix the issue?Vampire
08/31/2024, 10:15 AMbuildscript to apply and plugins,
but buildscript and apply to plugins.
And probably it will.Horizon
09/02/2024, 3:17 AMplugins {
id 'com.android.application' version '8.6.0' apply false // Same as the version in the android/build.gradle
id 'com.android.library' version '8.6.0' apply false
id 'kotlin-android' version '1.7.20' // Same as the kotlin_version
id 'com.google.gms.google-services' version '4.4.2' // Same as the version in the android/build.gradle
}
In my android/build.gradle, I removed the classpaths
buildscript {
ext.kotlin_version = '1.7.20'
repositories {
google()
mavenCentral()
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
My error is :
* What went wrong:
Plugin [id: 'com.android.application', version: '8.6.0', apply: false] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Included Builds (No included builds contain this plugin)
- Plugin Repositories (could not resolve plugin artifact 'com.android.application:com.android.application.gradle.plugin:8.6.0')
Searched in the following repositories:
Gradle Central Plugin Repository
Im running Gradle 8.7 in the gradle-wrapper-properties:
distributionUrl = https\://services.gradle.org/distributions/gradle-8.7-bin.zipVampire
09/02/2024, 8:14 AMgoogle() as plugin repository in your settings script