Flitzcore
Flitzcore

Reputation: 344

Why i get gradle build error when adding image_picker into my dependecies?

I just simply add image_picker: to my dependecies and after i do pub upgrade i can't build the project. I get this error message:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':flutter_plugin_android_lifecycle'.
> Could not load compiled classes for build file 'C:\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_plugin_android_lifecycle-2.0.5\android\build.gradle' from cache.

My dependecies look like this:

dependencies:
  image_picker: ^0.8.4+11
  flutter:
    sdk: flutter
  
  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.2
  google_fonts: ^2.2.0
  sqflite: ^2.0.0+3
  intl: ^0.17.0

  path_provider: ^2.0.1

The strange thing is, when I do this in a new project, everything works fine. Even the image picker can run smoothly. The only diffrence is in my old project using gradle 6.7 and here using 7.4. Why is this happening?

Upvotes: 0

Views: 545

Answers (1)

Flitzcore
Flitzcore

Reputation: 344

I fix it with changing my gradle version to the older version

Upvotes: 1

Related Questions