这是indexloc提供的服务,不要输入任何密码
Skip to content

[camera] >= 0.5.3 android.media.ImageReader.getSurface() on null object #39109

@kevin-lot

Description

@kevin-lot

Since 0.5.3, camera plugin crashes with

 java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.Surface android.media.ImageReader.getSurface()' on a null object reference.

Last year, equivalent bug was posted: #19595

Steps to Reproduce

  1. Run application with camera preview without authorizations enabled.
  2. After authorizing camera and microphone
  3. Crash

Logs

note: I don't understand why but application don't crash in flutter run when verbose mode is on.

I/CameraManagerGlobal(14425): Connecting to camera service
D/AndroidRuntime(14425): Shutting down VM
E/AndroidRuntime(14425): FATAL EXCEPTION: main
E/AndroidRuntime(14425): Process: com.keyclic.app, PID: 14425
E/AndroidRuntime(14425): java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.Surface android.media.ImageReader.getSurface()' on a null object reference
E/AndroidRuntime(14425): 	at io.flutter.plugins.camera.Camera.startPreview(Camera.java:424)
E/AndroidRuntime(14425): 	at io.flutter.plugins.camera.Camera$3.onOpened(Camera.java:173)
E/AndroidRuntime(14425): 	at android.hardware.camera2.impl.CameraDeviceImpl$1.run(CameraDeviceImpl.java:143)
E/AndroidRuntime(14425): 	at android.os.Handler.handleCallback(Handler.java:873)
E/AndroidRuntime(14425): 	at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(14425): 	at android.os.Looper.loop(Looper.java:193)
E/AndroidRuntime(14425): 	at android.app.ActivityThread.main(ActivityThread.java:6669)
E/AndroidRuntime(14425): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(14425): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
E/AndroidRuntime(14425): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
I/Process (14425): Sending signal. PID: 14425 SIG: 9

[✓] Flutter (Channel stable, v1.7.8+hotfix.4, on Linux, locale fr_FR.UTF-8)
    • Flutter version 1.7.8+hotfix.4 at /home/kevin/Softwares/SDK/flutter
    • Framework revision 20e59316b8 (il y a 5 semaines), 2019-07-18 20:04:33
      -0700
    • Engine revision fee001c93f
    • Dart version 2.4.0
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.1)
    • Android SDK at /home/kevin/Softwares/SDK/android
    • Android NDK location not configured (optional; useful for native profiling
      support)
    • Platform android-29, build-tools 29.0.1
    • Java binary at:
      /home/kevin/Softwares/android-studio/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.
[✓] Android Studio (version 3.5)
    • Android Studio at /home/kevin/Softwares/android-studio
    • Flutter plugin version 38.2.3
    • Dart plugin version 191.8423
    • Java version OpenJDK Runtime Environment (build
      1.8.0_202-release-1483-b49-5587405)
[✓] VS Code (version 1.37.1)
    • VS Code at /usr/share/code
    • Flutter extension version 3.3.0
[✓] Connected device (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 9 (API
      28) (emulator)
• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    d: examplesSample code and demosp: cameraThe camera pluginpackageflutter/packages repository. See also p: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions