Reputation: 403
I generated a new Flutter project (Flutter v3.16) in VSCode on my Windows 10 machine and then tried to run the Flutter app. I didn't make any changes to the Flutter project as I was just trying to get it to work happy path. It booted up fine as a Windows application but when I tried to boot it up on the Pixel emulator, I got the error below.
FAILURE: Build failed with an exception.
Where: Settings file 'C:\Users\SFULLER01\StudioProjects\Test_flutter\android\settings.gradle' line: 26
What went wrong: Plugin [id: 'com.android.application', version: '7.3.0', 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.application:com.android.application.gradle.plugin:7.3.0') Searched in the following repositories: Google, MavenRepo, Gradle Central Plugin Repository
The Pixel emulator that I was using was Pixel 3a API 34 extension level 7 x86 64 (mobile)
. It's just the Android emulator that came with Android Studio when I installed it.
I thought maybe the issue was with Visual Studio Code, so I tried generating a new Flutter project with Android Studio (Giraffe), but I got the same error.
Maybe this is an issue with the Android Studio gradle version and the version of Gradle that Flutter is expecting? I don't know. If it is, I'm not sure how to go about resolving this issue.
Does anyone know how to resolve this error?
Upvotes: 4
Views: 3061
Reputation: 403
Turns out this was an issue with Visual Studio Code's Java extension. It was pointing to the wrong Java version. Since I didn't need that plugin anyway, I just removed it.
Upvotes: 0
Reputation: 85
Use this
plugin{
id "com.android.application"
}
instead of this
plugin{
id: 'com.android.application', version: '7.3.0', apply: false
}
Note make this changes in app level gradle file
project/android/app/build.gradle
Upvotes: 0