OpenSooq / Gligar

📸Image Picker for Android, Pick an image from Gallery or Capture a new image with Camera.
https://engineering.opensooq.com
Apache License 2.0
158 stars 37 forks source link

Camera does not open #24

Closed jrcmadushanka closed 3 years ago

jrcmadushanka commented 3 years ago

Describe the bug

Getting following error when selecting the camera option. I tried the same function after wiping emulator and on an android 10 device. Is there any method to provide a custom file provider to Gligar instance?

E/Picker: Failed to find configured root that contains /storage/emulated/0/Android/data/{PACKAGE}/files/Pictures/JPEG_20210411_124746_450436341.jpg

To Reproduce Steps to reproduce the behavior:

  1. Click on camera button on the gallery view
  2. Camera interface doesn't open and getting the previously mentioned error

Expected behavior Camera interface should appear and allow user to capture images

Screenshots If applicable, add screenshots to help explain your problem. image

Include stack trace if exist

E/Picker: Failed to find configured root that contains /storage/emulated/0/Android/data/PACKAGE/files/Pictures/JPEG_20210411_124746_450436341.jpg java.lang.IllegalArgumentException: Failed to find configured root that contains /storage/emulated/0/Android/data/PACKAGE/files/Pictures/JPEG_20210411_124746_450436341.jpg at androidx.core.content.FileProvider$SimplePathStrategy.getUriForFile(FileProvider.java:744) at androidx.core.content.FileProvider.getUriForFile(FileProvider.java:418) at com.opensooq.supernova.gligar.ui.ImagePickerActivity.cameraPermissionGranted(ImagePickerActivity.kt:145) at com.opensooq.supernova.gligar.ui.ImagePickerActivity.checkCameraPermission(ImagePickerActivity.kt:169) at com.opensooq.supernova.gligar.ui.ImagePickerActivity.openCamera(ImagePickerActivity.kt:127) at com.opensooq.supernova.gligar.ui.ImagePickerActivity.onItemClicked(ImagePickerActivity.kt:256) at com.opensooq.supernova.gligar.adapters.ImagesAdapter$onBindViewHolder$1.onClick(ImagesAdapter.kt:38) at android.view.View.performClick(View.java:5637) at android.view.View$PerformClick.run(View.java:22429) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6119) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

Smartphone (please complete the following information):

kamraniftikhar95 commented 3 years ago

The camera dose not working on android10

Yazan98 commented 3 years ago

@kamraniftikhar95 @jrcmadushanka

Can you Give me more details about this Exception? like A Scenario or Current SDK Version, Sample Code, Application Package Name, Application Permissions in manifest Is Device Rooted?

jrcmadushanka commented 3 years ago

@Yazan98

The issue was with my file provider. I haven't added following paths since, I have used only the cache paths for other purposes.

image

Now It is working fine with both emulator and the device. Thank you.

@kamraniftikhar95 Now the camera function is working with my android 10 device.

kamraniftikhar95 commented 3 years ago

Thanks its working now