Skip to content

App crashes after adding image_picker plugin #24859

Closed

Description

@bhanu-mantri

App crashes after adding image_picker plugin.

pubspec.yaml

dependencies:
  image_picker: ^0.4.10
$ flutter doctor -v
[✓] Flutter (Channel beta, v0.11.12, on Linux, locale en_IN)
    • Flutter version 0.11.12 at /home/bhanu/software/flutter
    • Framework revision 06ec8d3b41 (15 hours ago), 2018-11-28 15:56:58 -0800
    • Engine revision 72c7a75672
    • Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)

[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
    • Android SDK at /home/bhanu/software/Android/Sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /home/bhanu/software/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
    • All Android licenses accepted.

[✓] Android Studio (version 3.2)
    • Android Studio at /home/bhanu/software/android-studio
    • Flutter plugin version 30.0.1
    • Dart plugin version 181.5656
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)

[✓] IntelliJ IDEA Community Edition (version 2018.2)
    • IntelliJ at /home/bhanu/software/idea-IC-182.4892.20
    • Flutter plugin version 29.1.3
    • Dart plugin version 182.4892.25

[✓] VS Code (version 1.29.1)
    • VS Code at /usr/share/code
    • Flutter extension version 2.21.0

[✓] Connected device (1 available)
    • Redmi 3S • 0123456789ABCDEF • android-arm64 • Android 8.1.0 (API 27)

• No issues found!
flutter run
Launching lib/main.dart on Redmi 3S in debug mode...
Initializing gradle...                                       1.4s
Resolving dependencies...                                    3.2s
Gradle task 'assembleDebug'...                                   
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
/home/bhanu/software/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.10/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerPlugin.java:8: error: package android.support.annotation does not exist
import android.support.annotation.VisibleForTesting;
                                 ^
/home/bhanu/software/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.10/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:15: error: package android.support.annotation does not exist
import android.support.annotation.VisibleForTesting;
                                 ^
/home/bhanu/software/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.10/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:16: error: cannot find symbol
import android.support.v4.app.ActivityCompat;
                             ^
  symbol:   class ActivityCompat
  location: package android.support.v4.app
/home/bhanu/software/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.10/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:17: error: package android.support.v4.content does not exist
import android.support.v4.content.FileProvider;
                                 ^
/home/bhanu/software/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.10/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerFileProvider.java:3: error: package android.support.v4.content does not exist
import android.support.v4.content.FileProvider;
                                 ^
/home/bhanu/software/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.10/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerFileProvider.java:10: error: cannot find symbol
public class ImagePickerFileProvider extends FileProvider {}
                                             ^
  symbol: class FileProvider
/home/bhanu/software/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.10/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerPlugin.java:40: error: cannot find symbol
  @VisibleForTesting
   ^
  symbol:   class VisibleForTesting
  location: class ImagePickerPlugin
/home/bhanu/software/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.10/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:68: error: cannot find symbol
  @VisibleForTesting static final int REQUEST_CODE_CHOOSE_IMAGE_FROM_GALLERY = 2342;
   ^
  symbol:   class VisibleForTesting
  location: class ImagePickerDelegate
/home/bhanu/software/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.10/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:69: error: cannot find symbol
  @VisibleForTesting static final int REQUEST_CODE_TAKE_IMAGE_WITH_CAMERA = 2343;
   ^
  symbol:   class VisibleForTesting
  location: class ImagePickerDelegate
/home/bhanu/software/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.10/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:70: error: cannot find symbol
  @VisibleForTesting static final int REQUEST_EXTERNAL_IMAGE_STORAGE_PERMISSION = 2344;
   ^
  symbol:   class VisibleForTesting
  location: class ImagePickerDelegate
/home/bhanu/software/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.10/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:71: error: cannot find symbol
  @VisibleForTesting static final int REQUEST_CAMERA_IMAGE_PERMISSION = 2345;
   ^
  symbol:   class VisibleForTesting
  location: class ImagePickerDelegate
/home/bhanu/software/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.10/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:72: error: cannot find symbol
  @VisibleForTesting static final int REQUEST_CODE_CHOOSE_VIDEO_FROM_GALLERY = 2352;
   ^
  symbol:   class VisibleForTesting
  location: class ImagePickerDelegate
/home/bhanu/software/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.10/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:73: error: cannot find symbol
  @VisibleForTesting static final int REQUEST_CODE_TAKE_VIDEO_WITH_CAMERA = 2353;
   ^
  symbol:   class VisibleForTesting
  location: class ImagePickerDelegate
/home/bhanu/software/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.10/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:74: error: cannot find symbol
  @VisibleForTesting static final int REQUEST_EXTERNAL_VIDEO_STORAGE_PERMISSION = 2354;
   ^
  symbol:   class VisibleForTesting
  location: class ImagePickerDelegate
/home/bhanu/software/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.10/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:75: error: cannot find symbol
  @VisibleForTesting static final int REQUEST_CAMERA_VIDEO_PERMISSION = 2355;
   ^
  symbol:   class VisibleForTesting
  location: class ImagePickerDelegate
/home/bhanu/software/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.10/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:77: error: cannot find symbol
  @VisibleForTesting final String fileProviderName;
   ^
  symbol:   class VisibleForTesting
  location: class ImagePickerDelegate
/home/bhanu/software/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.10/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:164: error: cannot find symbol
  @VisibleForTesting
   ^
  symbol:   class VisibleForTesting
  location: class ImagePickerDelegate
/home/bhanu/software/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.10/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:122: error: cannot find symbol
            return ActivityCompat.checkSelfPermission(activity, permissionName)
                   ^
  symbol: variable ActivityCompat
/home/bhanu/software/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.10/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:128: error: cannot find symbol
            ActivityCompat.requestPermissions(activity, new String[] {permissionName}, requestCode);
            ^
  symbol: variable ActivityCompat
/home/bhanu/software/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.10/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:140: error: cannot find symbol
            return FileProvider.getUriForFile(activity, fileProviderName, file);
                   ^
  symbol: variable FileProvider
20 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':image_picker:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* 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 13s
 
Gradle task 'assembleDebug'... Done                         14.3s
Gradle task assembleDebug failed with exit code 1

Activity

  1. changed the title [-]App crashes after adding image severe: crash[/-] [+]App crashes after adding image_picker plugin[/+] on Nov 29, 2018
  2. zoechi commented on Nov 29, 2018

    @zoechi
    Contributor

    Please try deleting /home/bhanu/software/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.10/ and then run flutter packages get again.

  3. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Nov 29, 2018
  4. bhanu-mantri commented on Nov 30, 2018

    @bhanu-mantri
    Author

    That is not working, it is showing the same error.

  5. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Nov 30, 2018
  6. added this to the milestone on Nov 30, 2018
  7. zoechi commented on Dec 4, 2018

    @zoechi
    Contributor

    #24201 (comment) might help

  8. bhanu-mantri commented on Dec 5, 2018

    @bhanu-mantri
    Author

    I already have classpath 'com.android.tools.build:gradle:3.2.1' classpath 'com.google.gms:google-services:4.1.0' in my project level build.gradle, It is not working.

  9. zoechi commented on Dec 5, 2018

    @zoechi
    Contributor

    @bhanu-manthry ensure you have distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip in android/gradle/wrapper7gradle-wrapper.properties

  10. added
    p: toolingAffects the flutter_plugin_tools package
    t: gradle"flutter build" and "flutter run" on Android
    platform-androidAndroid applications specifically
    on Jan 8, 2019
  11. 3 remaining items

  12. iKK001 commented on Feb 26, 2019

    @iKK001

    Same here ! I use AndroidX and the image_picker dependency makes again problems (I did an Android update today and afterwards nothing worked again with the image_picker dependency).

    I tried:

    a) delete package, found here...
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1
    b) make sure I have the AndroidX-version of the image_picker inside pubspec.yaml (currently this is image_picker: 0.4.12+1
    c) do flutter packages get so that the package gets re-installed fresh
    d) make a flutter clean
    e) I open Android Studio and all the grade compilation is successful - however, opening the Flutter App in Android does still crash !

    Something is still wrong. What else do I need to do in order to make image_picker work again in AndroidX ????

    Here is the error message I get:

    #/properties/flutter: unallowed additional property asserts
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerPlugin.java:8: error: package android.support.annotation does not exist
    import android.support.annotation.VisibleForTesting;
                                     ^
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:15: error: package android.support.annotation does not exist
    import android.support.annotation.VisibleForTesting;
                                     ^
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:16: error: cannot find symbol
    import android.support.v4.app.ActivityCompat;
                                 ^
      symbol:   class ActivityCompat
      location: package android.support.v4.app
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:17: error: package android.support.v4.content does not exist
    import android.support.v4.content.FileProvider;
                                     ^
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerFileProvider.java:3: error: package android.support.v4.content does not exist
    import android.support.v4.content.FileProvider;
                                     ^
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerFileProvider.java:10: error: cannot find symbol
    public class ImagePickerFileProvider extends FileProvider {}
                                                 ^
      symbol: class FileProvider
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerPlugin.java:40: error: cannot find symbol
      @VisibleForTesting
       ^
      symbol:   class VisibleForTesting
      location: class ImagePickerPlugin
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:68: error: cannot find symbol
      @VisibleForTesting static final int REQUEST_CODE_CHOOSE_IMAGE_FROM_GALLERY = 2342;
       ^
      symbol:   class VisibleForTesting
      location: class ImagePickerDelegate
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:69: error: cannot find symbol
      @VisibleForTesting static final int REQUEST_CODE_TAKE_IMAGE_WITH_CAMERA = 2343;
       ^
      symbol:   class VisibleForTesting
      location: class ImagePickerDelegate
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:70: error: cannot find symbol
      @VisibleForTesting static final int REQUEST_EXTERNAL_IMAGE_STORAGE_PERMISSION = 2344;
       ^
      symbol:   class VisibleForTesting
      location: class ImagePickerDelegate
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:71: error: cannot find symbol
      @VisibleForTesting static final int REQUEST_CAMERA_IMAGE_PERMISSION = 2345;
       ^
      symbol:   class VisibleForTesting
      location: class ImagePickerDelegate
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:72: error: cannot find symbol
      @VisibleForTesting static final int REQUEST_CODE_CHOOSE_VIDEO_FROM_GALLERY = 2352;
       ^
      symbol:   class VisibleForTesting
      location: class ImagePickerDelegate
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:73: error: cannot find symbol
      @VisibleForTesting static final int REQUEST_CODE_TAKE_VIDEO_WITH_CAMERA = 2353;
       ^
      symbol:   class VisibleForTesting
      location: class ImagePickerDelegate
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:74: error: cannot find symbol
      @VisibleForTesting static final int REQUEST_EXTERNAL_VIDEO_STORAGE_PERMISSION = 2354;
       ^
      symbol:   class VisibleForTesting
      location: class ImagePickerDelegate
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:75: error: cannot find symbol
      @VisibleForTesting static final int REQUEST_CAMERA_VIDEO_PERMISSION = 2355;
       ^
      symbol:   class VisibleForTesting
      location: class ImagePickerDelegate
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:77: error: cannot find symbol
      @VisibleForTesting final String fileProviderName;
       ^
      symbol:   class VisibleForTesting
      location: class ImagePickerDelegate
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:164: error: cannot find symbol
      @VisibleForTesting
       ^
      symbol:   class VisibleForTesting
      location: class ImagePickerDelegate
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:122: error: cannot find symbol
                return ActivityCompat.checkSelfPermission(activity, permissionName)
                       ^
      symbol: variable ActivityCompat
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:128: error: cannot find symbol
                ActivityCompat.requestPermissions(activity, new String[] {permissionName}, requestCode);
                ^
      symbol: variable ActivityCompat
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:140: error: cannot find symbol
                return FileProvider.getUriForFile(activity, fileProviderName, file);
                       ^
      symbol: variable FileProvider
    20 errors
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':image_picker:compileDebugJavaWithJavac'.
    > Compilation failed; see the compiler error output for details.
    
    * 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 19s
    *******************************************************************************************
    The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
    See https://goo.gl/CP92wY for more information on the problem and how to fix it.
    *******************************************************************************************
    Gradle task assembleDebug failed with exit code 1
    Exited (sigterm)
    
  13. iKK001 commented on Feb 26, 2019

    @iKK001

    I have found a solution:

    In gradle.properties set enableJetifier to false (i.e. only keep the first one to true)...

    android.useAndroidX=true
    android.enableJetifier=false
    

    I have no idea why this was suddenly necessary today.

    Any explanation highly appreciated. Thanks.

  14. diazsasak commented on Jun 10, 2019

    @diazsasak

    i have same exact issue. and i resolved by updating pubspec.yaml:
    from image_picker: ^0.4.10 to image_picker: ^0.6.0+9

  15. maylortaylor commented on Aug 2, 2019

    @maylortaylor

    Same here ! I use AndroidX and the image_picker dependency makes again problems (I did an Android update today and afterwards nothing worked again with the image_picker dependency).

    I tried:

    a) delete package, found here...
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1
    b) make sure I have the AndroidX-version of the image_picker inside pubspec.yaml (currently this is image_picker: 0.4.12+1
    c) do flutter packages get so that the package gets re-installed fresh
    d) make a flutter clean
    e) I open Android Studio and all the grade compilation is successful - however, opening the Flutter App in Android does still crash !

    Something is still wrong. What else do I need to do in order to make image_picker work again in AndroidX ????

    Here is the error message I get:

    #/properties/flutter: unallowed additional property asserts
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerPlugin.java:8: error: package android.support.annotation does not exist
    import android.support.annotation.VisibleForTesting;
                                     ^
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:15: error: package android.support.annotation does not exist
    import android.support.annotation.VisibleForTesting;
                                     ^
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:16: error: cannot find symbol
    import android.support.v4.app.ActivityCompat;
                                 ^
      symbol:   class ActivityCompat
      location: package android.support.v4.app
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:17: error: package android.support.v4.content does not exist
    import android.support.v4.content.FileProvider;
                                     ^
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerFileProvider.java:3: error: package android.support.v4.content does not exist
    import android.support.v4.content.FileProvider;
                                     ^
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerFileProvider.java:10: error: cannot find symbol
    public class ImagePickerFileProvider extends FileProvider {}
                                                 ^
      symbol: class FileProvider
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerPlugin.java:40: error: cannot find symbol
      @VisibleForTesting
       ^
      symbol:   class VisibleForTesting
      location: class ImagePickerPlugin
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:68: error: cannot find symbol
      @VisibleForTesting static final int REQUEST_CODE_CHOOSE_IMAGE_FROM_GALLERY = 2342;
       ^
      symbol:   class VisibleForTesting
      location: class ImagePickerDelegate
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:69: error: cannot find symbol
      @VisibleForTesting static final int REQUEST_CODE_TAKE_IMAGE_WITH_CAMERA = 2343;
       ^
      symbol:   class VisibleForTesting
      location: class ImagePickerDelegate
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:70: error: cannot find symbol
      @VisibleForTesting static final int REQUEST_EXTERNAL_IMAGE_STORAGE_PERMISSION = 2344;
       ^
      symbol:   class VisibleForTesting
      location: class ImagePickerDelegate
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:71: error: cannot find symbol
      @VisibleForTesting static final int REQUEST_CAMERA_IMAGE_PERMISSION = 2345;
       ^
      symbol:   class VisibleForTesting
      location: class ImagePickerDelegate
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:72: error: cannot find symbol
      @VisibleForTesting static final int REQUEST_CODE_CHOOSE_VIDEO_FROM_GALLERY = 2352;
       ^
      symbol:   class VisibleForTesting
      location: class ImagePickerDelegate
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:73: error: cannot find symbol
      @VisibleForTesting static final int REQUEST_CODE_TAKE_VIDEO_WITH_CAMERA = 2353;
       ^
      symbol:   class VisibleForTesting
      location: class ImagePickerDelegate
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:74: error: cannot find symbol
      @VisibleForTesting static final int REQUEST_EXTERNAL_VIDEO_STORAGE_PERMISSION = 2354;
       ^
      symbol:   class VisibleForTesting
      location: class ImagePickerDelegate
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:75: error: cannot find symbol
      @VisibleForTesting static final int REQUEST_CAMERA_VIDEO_PERMISSION = 2355;
       ^
      symbol:   class VisibleForTesting
      location: class ImagePickerDelegate
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:77: error: cannot find symbol
      @VisibleForTesting final String fileProviderName;
       ^
      symbol:   class VisibleForTesting
      location: class ImagePickerDelegate
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:164: error: cannot find symbol
      @VisibleForTesting
       ^
      symbol:   class VisibleForTesting
      location: class ImagePickerDelegate
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:122: error: cannot find symbol
                return ActivityCompat.checkSelfPermission(activity, permissionName)
                       ^
      symbol: variable ActivityCompat
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:128: error: cannot find symbol
                ActivityCompat.requestPermissions(activity, new String[] {permissionName}, requestCode);
                ^
      symbol: variable ActivityCompat
    /Users/username/Projects/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.12+1/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java:140: error: cannot find symbol
                return FileProvider.getUriForFile(activity, fileProviderName, file);
                       ^
      symbol: variable FileProvider
    20 errors
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':image_picker:compileDebugJavaWithJavac'.
    > Compilation failed; see the compiler error output for details.
    
    * 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 19s
    *******************************************************************************************
    The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
    See https://goo.gl/CP92wY for more information on the problem and how to fix it.
    *******************************************************************************************
    Gradle task assembleDebug failed with exit code 1
    Exited (sigterm)
    

    I too am getting this same issue when trying to update my app to AndroidX.
    If i have my app as non-AndroidX, it "works" but i get another issue of the selected image not appearing only when on actual device.

    Here is a stackoverflow for my issue -- https://stackoverflow.com/questions/57316514/image-not-showing-on-phone-but-shows-on-emulator

  16. NewITCorp commented on Aug 24, 2019

    @NewITCorp

    I have found a solution:

    In gradle.properties set enableJetifier to false (i.e. only keep the first one to true)...

    android.useAndroidX=true
    android.enableJetifier=false
    

    I have no idea why this was suddenly necessary today.

    Any explanation highly appreciated. Thanks.

    Is this a good to go workaround?

  17. added
    toolAffects the "flutter" command-line tool. See also t: labels.
    on Dec 3, 2019
  18. csells commented on Jan 13, 2020

    @csells
    Contributor

    @bhanu-manthry we've made a lot of improvements to our Gradle support, including for AndroidX. Can you test to see if this issue still occurs on 1.12?

  19. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jan 13, 2020
  20. iapicca commented on Feb 13, 2020

    @iapicca

    Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away!
    Thanks for your contribution.

    Could everyone who still has this problem please file a new issue with the exact descriptions what happens, logs and the output of 'flutter doctor -v' please.
    All system setups can be slightly different so it's always better to open new issues and reference related issues.

  21. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Feb 5, 2021
  22. shahzodjonweb commented on Apr 6, 2021

    @shahzodjonweb

    Use image_picker: ^0.6.6+1 and add AndroidManifest.xml following:
    <uses-permission android:name="android.permission.INTERNET"/>
    This way worked for me!

  23. github-actions commented on Aug 3, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  24. locked as resolved and limited conversation to collaborators on Aug 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: crashStack traces logged to the consolep: image_pickerThe Image Picker plugin.p: toolingAffects the flutter_plugin_tools packagepackageflutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyt: gradle"flutter build" and "flutter run" on AndroidtoolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions