ChiliLabs / ChiliPhotoPicker

Photo picker library for android. Let's you pick photos directly from files, or navigate to camera or gallery.
Apache License 2.0
405 stars 45 forks source link

Photo from camera: crash Android 11 #19

Open mgursch opened 4 years ago

mgursch commented 4 years ago

Hello

I have Android 11 installed on my Pixel 2. Every time I try to select picture by camera the library crashes with the following stacktrace:

2020-09-30 11:08:05.444 7462-7462/com.landwirt E/AndroidRuntime: FATAL EXCEPTION: main Process: com.landwirt, PID: 7462 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.landwirt/lv.chi.photopicker.utils.CameraActivity}: java.lang.IllegalStateException: intent.resolveActivity(packageManager) must not be null at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3449) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7656) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) Caused by: java.lang.IllegalStateException: intent.resolveActivity(packageManager) must not be null at lv.chi.photopicker.utils.CameraActivity.requestImageCapture(CameraActivity.kt:85) at lv.chi.photopicker.utils.CameraActivity.onCreate(CameraActivity.kt:30) at android.app.Activity.performCreate(Activity.java:8000) at android.app.Activity.performCreate(Activity.java:7984) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422)

mgursch commented 4 years ago

Solution is to add the following lines to AndroidManifest

is there any way to provide this through the library or add this at least to readme

paolorotolo commented 3 years ago

For others having the same issue, the lines to add to AndroidManifest are the following:

    <queries>
        <intent>
            <action android:name="android.media.action.IMAGE_CAPTURE" />
        </intent>
    </queries>
paolorotolo commented 3 years ago

This is fixed by #24

roiskhoiron commented 3 years ago

For others having the same issue, the lines to add to AndroidManifest are the following:

    <queries>
        <intent>
            <action android:name="android.media.action.IMAGE_CAPTURE" />
        </intent>
    </queries>

Nice ! its work for me

danc243 commented 3 years ago

For others having the same issue, the lines to add to AndroidManifest are the following:

    <queries>
        <intent>
            <action android:name="android.media.action.IMAGE_CAPTURE" />
        </intent>
    </queries>

Works for me!