Sun Wareechuensuk
Sun Wareechuensuk

Reputation: 93

image_picker_modern causes build fail when running on android emulator

image_picker_modern causes build fail when running on android emulator This is the error I got after adding image_picker_modern dependency on pubspec.yaml file. The iOS simulator works perfectly fine, but the android emulator couldn't even build.

FAILURE: Build failed with an exception.                                

* What went wrong:                                                      
A problem occurred configuring project ':image_picker_modern'.          
> groovy.lang.MissingPropertyException: No such property: dir for class: org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection

* 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 https://help.gradle.org                              

BUILD FAILED in 2s                                                      
Running Gradle task 'assembleDebug'...                                  
Running Gradle task 'assembleDebug'... Done                        12.6s
Gradle task assembleDebug failed with exit code 1

I do not know what the problem is, since the app works as it should on iOS. This is a part of my pubspec.yaml file

 cupertino_icons: ^0.1.2
  provider: ^3.0.0
  http: ^0.12.0+4
  path_provider: ^1.1.0
  shared_preferences: ^0.5.6
  image_picker_modern: ^0.4.12+3
  firebase_storage: ^3.1.1

I looked for the solutions online, but didn't fine similar problem, maybe it has to do with gradle build version. Thank you for your help

Upvotes: 1

Views: 663

Answers (1)

Emad Soliman
Emad Soliman

Reputation: 29

change classpath in android build.gradle to classpath 'com.android.tools.build:gradle:3.3.0' and change distributionUrl in android/gradle/gradle-wrapper.properties to distributionUrl=https://services.gradle.org/distributions/gradle-4.10.2-all.zip

Upvotes: 3

Related Questions