Skip to content

App crashes after adding image_picker plugin #24859

@bhanu-mantri

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

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