title: Flutter plugins not working under Android
body: <p>In my Flutter App, I make usage of many plugins.</p>
  
  <p>However, there are some of them that simply won't work under Android (i.e. under iOS they work perfectly fine).</p>
  
  <p>Inside <code>pubspec.yaml</code> File I have the following list of packages that I intend to use in my Flutter app.</p>
  
  <p>The ones commented-out do not work under Android !</p>
  
  <pre class="lang-dart prettyprint-override"><code>dependencies:
    flutter:
      sdk: flutter
    shared_preferences: ^0.5.2+1
    sqflite: ^1.1.5
    intl: ^0.15.8
    tuple: ^1.0.2
    material_design_icons_flutter: ^3.2.3695
    launch_review: ^2.0.0
    fit_image: ^0.1.2
    datetime_picker_formfield: ^0.1.8
    flutter_screenutil: ^0.5.2
    path_provider: ^1.1.0
    # image_picker: ^0.6.0+8
    # url_launcher: ^5.0.2
    # permission_handler: ^3.1.0
    # flutter_downloader: ^1.1.7
    large_file_copy: ^0.0.1
    flutter_localizations:
      sdk: flutter
    cupertino_icons: ^0.1.2
  </code></pre>
  
  <p>I work with Android SDK 28</p>
  
  <p>My Flutter project, I create with:</p>
  
  <pre class="lang-dart prettyprint-override"><code>flutter create --org ch.myorg -i swift -a kotlin &lt;my_app_name&gt;
  </code></pre>
  
  <p><strong>How can I get these packages to work under Android ????</strong></p>
  
  <pre class="lang-dart prettyprint-override"><code>  image_picker: ^0.6.0+8
    url_launcher: ^5.0.2
    permission_handler: ^3.1.0
    flutter_downloader: ^1.1.7
  </code></pre>
  
  <p>I did the following trials:</p>
  
  <ul>
  <li>typed <code>flutter clean</code></li>
  <li>typed <code>flutter packages get</code></li>
  <li>opened Android Studio to see if it cleans the bugs - but no chance</li>
  <li>migrated to AndroidX (but this is the biggest mess you can imagine since corrupting the other packages that worked fine before the migration)</li>
  <li>I created a completely new Flutter project and added no code whatsoever (i.e. work with the hello-world app) and keep adding packages to the pubspec.yaml file to see which packages crash the Android version. Then for the first one crashing, I try to step back versions in order to find any package-version that might not crash. But this is like finding a needle in a haystack... No chance either...</li>
  <li>I went to get the package-creator's GitHub project and tried their example app (i.e. each package has an example) - but the same issue: Android does not work !</li>
  <li>I created a completely new Flutter app and took the main.dart content of a package-provider-example main.dart code (in order to have all the android\local.properties etc. in a correct state given by the flutter create) and then I added the pubspec.yaml content form the package also into the new flutter app in order to get the necessary dependency. But same, thing: Android does not work !! (iOS works always..)</li>
  <li>I uninstalled Android Studio and re-installed it. I uninstalled Flutter and Dart and re-installed it. No effect...</li>
  </ul>
  
  <p>I am more than desperate to get this to work since I lost 6 days so far trying to get these Flutter packages to run under Android... :(</p>
  
  <p>Any help highly appreciated.</p>
  
  <p>Here is my <code>flutter doctor -v</code> output:</p>
  
  <pre class="lang-dart prettyprint-override"><code>flutter doctor -v
  [✓] Flutter (Channel stable, v1.5.4-hotfix.2, on Mac OS X 10.14.5 18F132, locale
      en-CH)
      • Flutter version 1.5.4-hotfix.2 at /Users/user/Documents/flutter
      • Framework revision 7a4c33425d (4 weeks ago), 2019-04-29 11:05:24 -0700
      • Engine revision 52c7a1e849
      • Dart version 2.3.0 (build 2.3.0-dev.0.5 a1668566e5)
  
  
  [✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
      • Android SDK at /Users/user/Library/Android/sdk
      • Android NDK location not configured (optional; useful for native profiling
        support)
      • Platform android-28, build-tools 28.0.3
      • Java binary at: /Applications/Android
        Studio.app/Contents/jre/jdk/Contents/Home/bin/java
      • Java version OpenJDK Runtime Environment (build
        1.8.0_152-release-1343-b01)
      • All Android licenses accepted.
  
  [✓] iOS toolchain - develop for iOS devices (Xcode 10.2.1)
      • Xcode at /Applications/Xcode.app/Contents/Developer
      • Xcode 10.2.1, Build version 10E1001
      • ios-deploy 1.9.4
      • CocoaPods version 1.6.1
  
  [✓] Android Studio (version 3.4)
      • Android Studio at /Applications/Android Studio.app/Contents
      • Flutter plugin version 35.3.1
      • Dart plugin version 183.6270
      • Java version OpenJDK Runtime Environment (build
        1.8.0_152-release-1343-b01)
  
  [✓] VS Code (version 1.34.0)
      • VS Code at /Applications/Visual Studio Code.app/Contents
      • Flutter extension version 3.0.2
  
  [✓] Connected device (1 available)
      • Android SDK built for x86 • emulator-5554 • android-x86 • Android 9 (API
        28) (emulator)
  
  • No issues found!
  </code></pre>
  
  <hr>
  
  <p>Here is an example of getting one single package to work under Android - my trial is with <code>file_downloader</code> (<a href="https://pub.dev/packages/flutter_downloader" rel="nofollow noreferrer">Link to package definition</a>):</p>
  
  <p>Below you find the cryptic error log when I try with the <code>file_downloader</code> package:</p>
  
  <p><strong>Step 1 :</strong> create a completely new Flutter project with <code>flutter create --org com.myorg -i swift -a kotlin testy</code></p>
  
  <p><strong>Step 2 :</strong> fill in the package-dependencies inside the <code>pubsep.yaml</code> file (i.e. taken from the package-example). Here are the dependencies for this package example:</p>
  
  <pre class="lang-dart prettyprint-override"><code>dependencies:
    flutter:
      sdk: flutter
    path_provider: ^0.4.0
    permission_handler: ^3.0.0
    flutter_downloader: ^1.1.7
    cupertino_icons: ^0.1.2
  </code></pre>
  
  <p><strong>Step 3 :</strong> Keep the main.dart as the default "hello world" app (i.e what is there after flutter create...)</p>
  
  <p>Therefore we only changed a few pubspec.yaml dependencies in comparison with a fresh new Flutter create app. And the dependecies is what the package-provider suggests in his/her example !</p>
  
  <p>The "hello world" App works fine under Android &amp; iOS. However, adding a few pubspec.yaml dependencies makes the Android crash (iOS works fine)...</p>
  
  <p>Here is the error log when Android is launched:</p>
  
  <pre class="lang-dart prettyprint-override"><code>* Error running Gradle:
  ProcessException: Process "/Users/user/Flutter_applications/01_MyOwn_Flutter_apps/testy/android/gradlew" exited abnormally:
  Starting a Gradle Daemon, 5 stopped Daemons could not be reused, use --status for details
  
  
  FAILURE: Build failed with an exception.
  
  * Where:
  Script '/Users/user/Documents/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 200
  
  * What went wrong:
  A problem occurred configuring project ':flutter_downloader'.
  &gt; Failed to notify project evaluation listener.
     &gt; Could not get unknown property 'android' for project ':flutter_downloader' of type org.gradle.api.Project.
     &gt; Could not find method debugProvided() for arguments [file collection] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
  
  * 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 7s
    Command: /Users/user/Flutter_applications/01_MyOwn_Flutter_apps/testy/android/gradlew app:properties
  
  Exited (sigterm)
  </code></pre>
  
  <p>Other packages deliver slightly different errors. But it is always something with a gradle-issue or an android-incompatibility. What Android version do I need to install ? Isn't the newest stable one the best option ??  How do I find out which package-versions fit which Android-version ? How can I match the two ??? (and still keep all my other packages running).</p>
  
  <p>After my odyssey, I wonder, isn't Flutter a bit of a mess if it comes to Android dependencies ??? </p>
  
  <p>Any suggestion on how to deal with these kind of problems are highly appreciated. How do you proceed normally with Flutter packages and Android compatibility ???</p>
  
  <hr>
  
  <p>Or here another example with <code>image_picker</code> package (<a href="https://pub.dev/packages/image_picker" rel="nofollow noreferrer">coming from Flutter Team here</a>):</p>
  
  <p>Steps 1-3 are the same as above. All I do is creating a hello-world Flutter app and adding the dependencies as stated in the package-example:</p>
  
  <p>Here the image_picker dependencies:</p>
  
  <pre class="lang-dart prettyprint-override"><code>dependencies:
    flutter:
      sdk: flutter
    video_player: 0.5.2
    image_picker: ^0.6.0+8
    cupertino_icons: ^0.1.2
  </code></pre>
  
  <p>And here the Android Error:</p>
  
  <pre class="lang-dart prettyprint-override"><code>* Error running Gradle:
  ProcessException: Process "/Users/user/Flutter_applications/01_MyOwn_Flutter_apps/testy/android/gradlew" exited abnormally:
  
  FAILURE: Build failed with an exception.
  
  * Where:
  Script '/Users/user/Documents/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 200
  
  * What went wrong:
  A problem occurred configuring project ':image_picker'.
  &gt; Failed to notify project evaluation listener.
     &gt; Could not get unknown property 'android' for project ':image_picker' of type org.gradle.api.Project.
     &gt; Could not find method debugProvided() for arguments [file collection] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
  
  * 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 0s
    Command: /Users/user/Flutter_applications/01_MyOwn_Flutter_apps/testy/android/gradlew app:properties
  
  Please review your Gradle project setup in the android/ folder.
  Exited (sigterm)
  </code></pre>