I am working on a Flutter project and everything was working fine. Suddenly, without making any changes, I started getting this Gradle build error when running flutter run:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':audio_streamer'.
> Could not load compiled classes for build file 'C:\Users\Nathan\AppData\Local\Pub\Cache\hosted\pub.dev\audio_streamer-4.1.1\android\build.gradle' from cache.
> Failed to notify project evaluation listener.
> Could not get unknown property 'android' for project ':audio_streamer' of type .gradle.api.Project.
> Could not get unknown property 'android' for project ':audio_streamer' of type .gradle.api.Project.
* 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 .
BUILD FAILED in 1s
What I tried so far:
- Checked pubspec.yaml → audio_streamer is not listed as a direct dependency
- Ran flutter pub outdated → audio_streamer is not listed
- Tried flutter clean and flutter pub get → Still the same error
- Manually deleted audio_streamer from the cache (~/.pub-cache/hosted/pub.dev/audio_streamer*) and reinstalled dependencies → No luck
- Added dependency_overrides: audio_streamer: none in pubspec.yaml → Still getting the error
Here my pubspec.yaml
:
name: sonometre_test
description: A new Flutter project.
# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# .html
version: 1.0.0+1
environment:
sdk: ">=3.0.0 <4.0.0"
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
flutter_web_plugins:
sdk: flutter
auto_size_text: 3.0.0
cached_network_image: 3.4.1
cached_network_image_platform_interface: 4.1.1
cached_network_image_web: 1.3.1
collection: 1.19.1
flutter_animate: 4.5.0
flutter_cache_manager: 3.4.1
font_awesome_flutter: 10.7.0
from_css_color: 2.0.0
go_router: 12.1.3
google_fonts: 6.1.0
intl: 0.19.0
json_path: 0.7.2
noise_meter: ^5.0.2
page_transition: 2.1.0
path_provider: 2.1.4
path_provider_android: 2.2.10
path_provider_foundation: 2.4.0
path_provider_linux: 2.2.1
path_provider_platform_interface: 2.1.2
path_provider_windows: 2.3.0
provider: 6.1.2
shared_preferences: 2.3.2
shared_preferences_android: 2.3.2
shared_preferences_foundation: 2.5.2
shared_preferences_linux: 2.4.1
shared_preferences_platform_interface: 2.4.1
shared_preferences_web: 2.4.2
shared_preferences_windows: 2.4.1
sqflite: 2.3.3+1
sqflite_common: 2.5.4+3
timeago: 3.6.1
url_launcher: 6.3.0
url_launcher_android: 6.3.10
url_launcher_ios: 6.3.1
url_launcher_linux: 3.2.0
url_launcher_macos: 3.2.1
url_launcher_platform_interface: 2.3.2
url_launcher_web: 2.3.3
url_launcher_windows: 3.1.2
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.0
dependency_overrides:
http: 1.2.2
uuid: ^4.0.0
dev_dependencies:
flutter_lints: 4.0.0
lints: 4.0.0
flutter_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: /tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets:
- assets/fonts/
- assets/images/
- assets/videos/
- assets/audios/
- assets/rive_animations/
- assets/pdfs/
- assets/jsons/
# An image asset can refer to one or more resolution-specific "variants", see
# /assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# /assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see /custom-fonts/#from-packages