Ozan Taskiran
Ozan Taskiran

Reputation: 3552

Image_picker dependency in Flutter doesn't let me compile my app with an Error message

I wanted to add the image_picker library for my App registration, where the user can pick an image when he clicks on a button. My dependecies:

dependencies:
  flutter:
    sdk: flutter
  provider: ^3.2.0
  firebase_auth: ^0.15.2
  password_strength: ^0.1.2
  keyboard_avoider: ^0.1.2
  image_picker: ^0.6.2+3

Everything worked nice but after adding the image_picker in the pubspec.yaml i get the error:

FAILURE: Build failed with an exception.

BUILD FAILED in 1s The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility. Building plugin firebase_auth...

FAILURE: Build failed with an exception.

BUILD FAILED in 0s The plugin firebase_auth could not be built due to the issue above. Exited (sigterm)

Edit: Flutter doctor -v Output

PS D:\Flutter Projekte\helper> flutter doctor -v
[√] Flutter (Channel stable, v1.12.13+hotfix.5, on Microsoft Windows [Version 10.0.18362.535], locale de-DE)
    • Flutter version 1.12.13+hotfix.5 at C:\src\flutter
    • Framework revision 27321ebbad (6 days ago), 2019-12-10 18:15:01 -0800
    • Engine revision 2994f7e1e6
    • Dart version 2.7.0


[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at C:\Users\Ozan\AppData\Local\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses

[√] Android Studio (version 3.5)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 40.2.2
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

[!] IntelliJ IDEA Community Edition (version 2019.2)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.2.2
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
    • For information about installing plugins, see
      https://flutter.dev/intellij-setup/#installing-the-plugins

[√] VS Code (version 1.41.0)
    • VS Code at C:\Users\Ozan\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.7.1

[√] Connected device (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)

! Doctor found issues in 2 categories.

flutter doctor -- android-licenses output

flutter doctor --android-licenses
Warning: Observed package id 'extras;intel;Hardware_Accelerated_Execution_Manager' in inconsistent location 'C:\Users\Ozan\AppData\Local\Android\Sdk\.temp\PackageOperation01' (Expected 'C:\Users\Ozan\AppData\Local\Android\Sdk\extras\intel\Hardware_Accelerated_Execution_Manager')
Warning: Observed package id 'extras;intel;Hardware_Accelerated_Execution_Manager' in inconsistent location 'C:\Users\Ozan\AppData\Local\Android\Sdk\.temp\PackageOperation01' (Expected 'C:\Users\Ozan\AppData\Local\Android\Sdk\extras\intel\Hardware_Accelerated_Execution_Manager')
                                                                                Warning: File C:\Users\Ozan\.android\repositories.cfg could not be loaded.
All SDK package licenses accepted.======] 100% Computing updates...

local.properties file

sdk.dir=C:\\Users\\Ozan\\AppData\\Local\\Android\\sdk
flutter.sdk=C:\\src\\flutter
flutter.buildMode=debug
flutter.versionName=1.0.0
flutter.versionCode=1

Upvotes: 1

Views: 4183

Answers (1)

Peter Haddad
Peter Haddad

Reputation: 80904

Update flutter to version 1.12 which uses AndroidX by default:

https://flutter.dev/docs/development/tools/sdk/release-notes/release-notes-1.12.13#android

You can upgrade by executing the following command:

 flutter upgrade

After doing flutter upgrade, then add the sdk path to android_home:

export ANDROID_HOME="YOUR_SDK_PATH" 

Also upgrade both the android gradle in the build.gradle and the kotlin version:

dependencies {
    classpath 'com.android.tools.build:gradle:3.3.1' 
}

Upvotes: 2

Related Questions