Horizon
09/03/2024, 8:35 AMERROR:
* Where:
Build file '...android\app\build.gradle' line: 3
* What went wrong:
Plugin [id: 'com.android.application', version: '8.5.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.5.0')
Searched in the following repositories:
Gradle Central Plugin Repository
app/build.gradle:
plugins {
//noinspection AndroidGradlePluginVersion
id 'com.android.application' version '8.5.0' apply false
id 'org.jetbrains.kotlin.android' version '1.9.22' apply false
id 'dev.flutter.flutter-gradle-plugin' apply false
id 'com.google.gms.google-services' version '4.4.2' apply false
}
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
namespace 'com.example.application'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
applicationId "appName"
minSdkVersion 21
compileSdk 34
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
ndk {
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86_64'
}
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
ndkVersion '25.1.8937393'
compileSdk 34
}
flutter {
source '../..'
}
My android/build.gradle:
allprojects {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
rootProject.layout.buildDirectory = '../build'
subprojects {
project.layout.buildDirectory = "${rootProject.layout.buildDirectory}/${project.name}"
project.evaluationDependsOn(":app")
}
subprojects {
project.evaluationDependsOn(':app')
}
tasks.register("clean", Delete) {
delete rootProject.layout.buildDirectory
}
subprojects {
afterEvaluate { project ->
if (project.hasProperty('android')) {
project.android {
if (namespace == null) {
namespace project.group
}
}
}
}
}
My AppName/gradle settings:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
rootProject.name = "My Application"
include ':app'
project(':app').projectDir = new File(rootDir, 'company/android/app/')
android/settings.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 'com.android.application' version '8.5.0'
id 'org.jetbrains.kotlin.android' version ''1.9.22'
id 'dev.flutter.flutter-gradle-plugin'
id "dev.flutter.flutter-plugin-loader"
id 'com.google.gms.google-services' version '4.4.2'
}
include ":app"
gradle-wrapper-properties:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
I tried to check all the version compatibility but keep facing the same error. I asked a similar question earlier but i didn't provide all the affected files. Hope these files will help debug the issue. I've been stuck for days.Vampire
09/03/2024, 3:02 PMapp project in two builds. Never ever ever ever ever ever do that. One project should always only included in exactly one build. If it is need on another build too, three whole build should be included using composite builds instead. This is also part of your problem. In one of the build including that project you define google() as plugin repository, in the other you don't. So you try to execute the build where you didn't and there the AGP then cannot be located.