I have been stuck into a problem for quite a while. In my flutter project I have recently migrated to using DSL plugin and a package requires to add → classpath ‘com.android.tools.build:gradle:7.3.1’ . However, while adding a ‘com.android.tools.build’ plugin Im getting an error. I would really appreciate if someone could guide me in this as I have been stuck in this for quite a while:
Plugin [id: 'com.android.tools.build', version: '7.3.1', apply: false] was not found in any of the following sources:
* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Exception is:
org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'com.android.tools.build', version: '7.3.1', apply: false] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Included Builds (None of the included builds contain this plugin)
- Plugin Repositories (could not resolve plugin artifact 'com.android.tools.build:com.android.tools.build.gradle.plugin:7.3.1')
Searched in the following repositories:
Google
MavenRepo
Gradle Central Plugin ....
these are my gradle setup files:
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.tools.build' version '7.3.1' apply false // ERROR HERE
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version '7.4.2' apply false
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
id 'com.google.gms.google-services' version "4.3.15" apply false
}
include ":app"
android/app/build.gradle:
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
id "com.google.gms.google-services"
id 'com.android.tools.build'
}
android {
namespace "com.hoosouttonight.hot"
compileSdkVersion rootProject.ext.compileSdkVersion
ndkVersion flutter.ndkVersion
compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
applicationId "com.appid.app"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
signingConfigs {
}
buildTypes {
release {
signingConfig signingConfigs.release
shrinkResources false
}
}
}
flutter {
source '../..'
}
dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.2.2'
implementation 'androidx.window:window:1.0.0'
implementation 'androidx.window:window-java:1.0.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10"
}