[Camera Plugin] Application crashes and restarts when taking and confirming a picture
camera-plugin
Mobile icon
Forge component by Platform Maintenance
Application Type
Mobile

When capturing an image with the Camera plugin it crashes everytime I take a picture and the app restarts. This only happens on Android 10 and 11. It works perfectly fine on Android 9. I can't find an error log anywhere and I can't catch any exceptions when debugging on a mobile device. The debugging is killed as soon as an image is captured and then once the image captured is confirmed it restarts the application.

I am using the latest stable version of the plugin. Version 7.1.2 on phones with Android 10 and 11 and I am using Outsystems 11.12.6 build 51684.

Solution

Hi @Rudolph Kalp and OutSystems community,

Thank you for you questions. We are sorry that you were facing this issue on the Camera Plugin for quite some time. We have recently released a new version of the Camera Plugin (7.1.8) on Forge that we believe can fix these issues you reported, where for Android versions like 10 the app was crashing after taking the picture and confirming, on some devices.

Please do let us know if this new version fixes your problems.

Thank you.


Best regards,

Alexandre Jacinto 

Champion

Hi,


We got the same problem, only run on Android 9, but not on 10 and 11. 

For our case, we manage to fix this by deleting the plugin and installing the newest version (don't know why when we update the plugin, the problem still exists.)

Also we check the plugin, and git pages, and change the git version on the plugin (Extensibility Configurations) to the latest.


Thanks

Thanks for the response @Toto but this did not work for me. I have removed and reinstalled the plugin and regenerated the app but it still crashes every time I take a picture. I have also even manually edited the extensibility properties in the plugin to update the version in there but still no success.

I am getting an error now. Shown below:

A fatal error has occurred. Please contact OutSystems support: Failure delivering result ResultInfo{who=null, request=33, result=-1, data=null} to activity {com.outsystemsenterprise.tstopsgobid.MobileReceiving/com.outsystemsenterprise.tstopsgobid.MobileReceiving.MainActivity}: android.app.RecoverableSecurityException: com.outsystemsenterprise.tstopsgobid.MobileReceiving has no access to content://media/external/images/media/30 


I have given rights to the external storage to read and write but still this problem persists.

Champion

Hi,

Have you give permission after installing on the Android (or using https://www.outsystems.com/forge/component-overview/2040/android-permissions-plugin) ?

After change the plugin (reinstall, change extensibility), you need to refresh dependency and rebuild the apk/aab before uninstall old app on android and install new apk/aab. From my experience, if you update the app, there is a probability something not work as intended, so we usually do uninstall and reinstall than updated the app on the android device.


Thanks  

I changed it to use the android permission forge component as our app is used only on android devices for internal operational devices.

I have uninstalled the camera plugin and reinstalled it and then regenerated the APK and then uninstalled the app on the device and reinstalled the app again but still it gives the same problem.

Champion

Hi,


Have you check the logcat on android ? Should have more info.

Also, can you create dummy app using those plugin and test it if still problem ? If still problem put the apk/aab here, I'll try to check the logcat.


Thanks


Hi @Rudolph Kalp !

First of all, thank you for your question. I believe this could be related to a memory issue, that is, if the device does not have the necessary memory left when coming from the Camera view back to the app, the operating system can kill the app. In that case, we suggest lowering the picture quality to avoid this.

Please let us know if this suggestion helped, and if so, we would kindly ask you to mark this answer as the solution.


Best regards,

Alexandre Jacinto

Hi @Alexandre Jacinto,

Thank you for the response but it isn't the quality of the image. I created a test application and only included the Camera Plugin library and it still crashes even when I set the quality of the image to 10%. On Android 10 I get the following error when it crashes but on Android 11 I don't receive any error message anywhere.

A fatal error has occurred. Please contact OutSystems support: Failure delivering result ResultInfo{who=null, request=33, result=-1, data=null} to activity {com.outsystemsenterprise.tstopsgobid.Test/com.outsystemsenterprise.tstopsgobid.Test.MainActivity}: android.app.RecoverableSecurityException: com.outsystemsenterprise.tstopsgobid.Test has no access to content://media/external/images/media/54 

Please find attached my Test application.

Test.apk

Champion

Hi,


Can you change the screen to anonymous ?

Cannot tested this because of login screen.


Thanks

@Toto please find attached the updated application.

Test.oap

Champion

Hi Rudolph,


What device did you tested with ? Probably the device problem.

I have test this using Android 10 on Pocophone F1 using your apk and work normally. (see the video)

My suggestion is still, get the logcat from your android device. I can help to check the log.


Thanks

1636512014442-1.mp4

Thank you for the feedback @Toto. Have you tested this on an Android 11 phone? I am experiencing the same issue on an Android 11 phone.

The Android 10 device is a Ulefone Armor X7 Pro.

The Android 11 device is a Xiaomi Redmi 9.


@Toto do you perhaps a memory card in your phone?

Champion

Hi Rudolph,


Yes I'm using memory card on the phone.

But still, better to check the logcat from impacted devices, usually have more information on them.

You can use universal adb (https://adb.clockworkmod.com/) so you didn't need to download adb from google (the size is very big).

Then use on command prompt where adb is :
adb logcat -c (to clear the log on your device and to initialize listener to your device, make sure your device usb debugging is already turn on)

after that, take picture (should be crash right) then run this command :

adb logcat -d > c:\logcat.txt (this should save the logcat on drive c with logcat.txt file)


Thanks

Hi @Toto here is the logcat file from the Android 10 device.

logcat.txt

Champion

Hi,

Can you check the permission again ?

This log says, access is denied :

11-11 09:42:29.787 19055 19055 E OSCrashHandler: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=33, result=-1, data=null} to activity {com.outsystemsenterprise.tstopsgobid.Test/com.outsystemsenterprise.tstopsgobid.Test.MainActivity}: android.app.RecoverableSecurityException: com.outsystemsenterprise.tstopsgobid.Test has no access to content://media/external/images/media/61

11-11 09:42:29.787 19055 19055 E OSCrashHandler: at android.app.ActivityThread.deliverResults(ActivityThread.java:4901)

11-11 09:42:29.787 19055 19055 E OSCrashHandler: at android.app.ActivityThread.handleSendResult(ActivityThread.java:4942)

11-11 09:42:29.787 19055 19055 E OSCrashHandler: at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)

11-11 09:42:29.787 19055 19055 E OSCrashHandler: at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)

11-11 09:42:29.787 19055 19055 E OSCrashHandler: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)

11-11 09:42:29.787 19055 19055 E OSCrashHandler: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2069)

11-11 09:42:29.787 19055 19055 E OSCrashHandler: at android.os.Handler.dispatchMessage(Handler.java:107)

11-11 09:42:29.787 19055 19055 E OSCrashHandler: at android.os.Looper.loop(Looper.java:214)

11-11 09:42:29.787 19055 19055 E OSCrashHandler: at android.app.ActivityThread.main(ActivityThread.java:7417)

11-11 09:42:29.787 19055 19055 E OSCrashHandler: at java.lang.reflect.Method.invoke(Native Method)

11-11 09:42:29.787 19055 19055 E OSCrashHandler: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)

11-11 09:42:29.787 19055 19055 E OSCrashHandler: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:980)

11-11 09:42:29.787 19055 19055 E OSCrashHandler: Caused by: android.app.RecoverableSecurityException: com.outsystemsenterprise.tstopsgobid.Test has no access to content://media/external/images/media/61

11-11 09:42:29.787 19055 19055 E OSCrashHandler: at android.app.RecoverableSecurityException$1.createFromParcel(RecoverableSecurityException.java:197)

11-11 09:42:29.787 19055 19055 E OSCrashHandler: at android.app.RecoverableSecurityException$1.createFromParcel(RecoverableSecurityException.java:194)

11-11 09:42:29.787 19055 19055 E OSCrashHandler: at android.os.Parcel.readParcelable(Parcel.java:2973)

11-11 09:42:29.787 19055 19055 E OSCrashHandler: at android.os.Parcel.createException(Parcel.java:2066)

11-11 09:42:29.787 19055 19055 E OSCrashHandler: at android.os.Parcel.readException(Parcel.java:2039)

11-11 09:42:29.787 19055 19055 E OSCrashHandler: at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:188)

11-11 09:42:29.787 19055 19055 E OSCrashHandler: at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:140)

11-11 09:42:29.787 19055 19055 E OSCrashHandler: at android.content.ContentProviderProxy.delete(ContentProviderNative.java:553)

11-11 09:42:29.787 19055 19055 E OSCrashHandler: at android.content.ContentResolver.delete(ContentResolver.java:1949)

11-11 09:42:29.787 19055 19055 E OSCrashHandler: at org.apache.cordova.camera.CameraLauncher.checkForDuplicateImage(CameraLauncher.java:1259)

11-11 09:42:29.787 19055 19055 E OSCrashHandler: at org.apache.cordova.camera.CameraLauncher.processResultFromCamera(CameraLauncher.java:515)

11-11 09:42:29.787 19055 19055 E OSCrashHandler: at org.apache.cordova.camera.CameraLauncher.onActivityResult(CameraLauncher.java:843)

11-11 09:42:29.787 19055 19055 E OSCrashHandler: at org.apache.cordova.CordovaInterfaceImpl.onActivityResult(CordovaInterfaceImpl.java:159)

11-11 09:42:29.787 19055 19055 E OSCrashHandler: at org.apache.cordova.CordovaActivity.onActivityResult(CordovaActivity.java:361)

11-11 09:42:29.787 19055 19055 E OSCrashHandler: at android.app.Activity.dispatchActivityResult(Activity.java:8125)

11-11 09:42:29.787 19055 19055 E OSCrashHandler: at android.app.ActivityThread.deliverResults(ActivityThread.java:4894)

11-11 09:42:29.787 19055 19055 E OSCrashHandler: ... 11 more

I have triple checked the permission and the correct permission is assigned to the application. 


The problem is that the error states it looks for the external storage which there isn't. The phone only has internal storage.

Champion

Hi,


I tried this again on the phone that didn't have memory card slot (Pocophone F3) and it works. (see video)

Can you check the permission on the app properties (see video after this post)


Thanks

PocophoneF3-internalMemoryOlny.mp4

Champion

This is video for check permission (on Pocophone F3)

CheckPermission.mp4

Hi @Toto , please see the permission video attached.

Screenrecorder-2021-11-17-07-33-27-209.mp4

Please also see this video showing what it does on my Android 11 Xiaomi Redmi 9 device.

Screenrecorder-2021-11-17-07-39-54-699.mp4

And here is the logcat file for this Android 11 device.

logcat.txt

Champion

Hi,


This is very strange indeed. Did your devices is subjected in MDM systems ?

I notice this log :

11-17 07:29:52.772  1213  4634 W UriGrantsManagerService: No permission grants found for com.google.android.apps.photos

11-17 07:29:52.772  1213  4634 W UriGrantsManagerService: No permission grants found for com.google.android.apps.photos

This happen when you took the picture, but I'm not sure about this. 

Maybe test this by give permission for google photos app and see if this is the cause ?


Thanks

Yes we do have MDM but it is not fully managed. It is only to have our work items on our devices to seperate work items from personal items.

I have given Google Photos all of the available permissions and I have also even tried to make Google Photos the default system gallery app on my device but it doesn't allow it. Staring to think there is something specific to my device.

Champion

Hi,


Maybe for testing purpose, check the apk using your friends or family phone and check if it running or not. My guess is the MDM is doing something (also in the logcat, it seems whatsapp image is being converted(?), maybe this also from MDM)


Thanks

Thank you for the suggestion. I am going to remove MDM from my device and see.

@Toto I have tried the app with a brand new device that is freshly installed. This is an Android 11 device. The application still crashes. Please see the logcat for the device attached.

logcat.txt

Champion

Hi Rudolph,

This is what I think the problem :

Do this phone have camera app / camera manager ?

Hi @Toto 

Sorry we put this project a little bit on hold due to the camera issues being experienced.

We are still experiencing issues with regards to the camera plugin and I have even tried it with a memory card in the device but still experiencing the same issue. I have made sure that there is indeed a camera application on all the devices that we are experiencing the issue with.


I was wondering isn't there a way that the camera plugin can store the file locally and then return the file location of the image then we can get it from the device that way?

Champion

"I was wondering isn't there a way that the camera plugin can store the file locally and then return the file location of the image then we can get it from the device that way? " ==> you can tried find this with the cordova plugin, if there is a cordova camera plugin that do this like you specified.


My other suggestion, you can tried other camera plugin, or even using HTML5 camera (you can check my plugin https://www.outsystems.com/forge/component-overview/10866/camera-overlay-reactive , this is using HTML5)


Thanks

Hi @Rudolph Kalp,


I posted an answer on the main thread of this forum post stating that we released a new version of the Camera Plugin (7.1.8) on Forge that we believe can fix the issue you were experiencing. Please let us know if it did.


Best regards,

Alexandre Jacinto

Hi Toto

We are still experiencing this issue using the latest version of the plugin 7.1.5. 

Could it be related to this bug Not working for Android 11 - Apache/Cordova-Plugin-Camera (issueexplorer.com) 


Hi @Christoff le Roux ,

Thank you for your question. We recently released a new version of the Camera Plugin (7.1.8) on Forge that we believe can fix this issue. Please let us know if it does.

Thank you.


Best regards,

Alexandre Jacinto

Hi All,

I am facing the same Issue in Android 10. App is crashing after clicked picture.
Plugin Version 7.1.7
MABS version 8

If anyone have fixed version please share with us.

Thank you


_Navaneethan 

Hi Navaneethan M

We got around the issues by deleting all our OS mobile apps and build them in Xamarin



Hi @Navaneethan M,

Thank you for you question. We recently released a new version of the Camera Plugin (7.1.8) on Forge that we believe fixes the issue you reported.


Best regards,

Alexandre Jacinto

Solution

Hi @Rudolph Kalp and OutSystems community,

Thank you for you questions. We are sorry that you were facing this issue on the Camera Plugin for quite some time. We have recently released a new version of the Camera Plugin (7.1.8) on Forge that we believe can fix these issues you reported, where for Android versions like 10 the app was crashing after taking the picture and confirming, on some devices.

Please do let us know if this new version fixes your problems.

Thank you.


Best regards,

Alexandre Jacinto 

Hello All,

The update did not fix my issue with Android 10. App.

MABS 8.

Testing on a OnePlus 6t

Champion

Hi,


Have you tried uninstall first before reinstalling ?


Thanks

Hello Toto,

Thank you so much. After uninstalling and reinstalling the app it fixed my issue.

Champion

Hi Michael,


Yes, changing plugin (cordova) in mobile need to uninstall and reinstall in Outsystems.


Thanks

Hi,

I think your logic is wrong, Can you please Share your oml. So that i can look into the problem

Thanks and regards,

prasath

Hello,

I believe I miss understood your request Toto. I didn't uninstall and reinstall the camera plugin from my application. However, I uninstalled and reinstalled the application from my device and did a rebuild of the apk. 

To my understand, only applications with new plugin required a new build. In our situation this process didn't need to be done since the camera plugin was already in our application. With that all said, this process did fix my issue on my device.

Prasath, I appreciate your assistants. Our application current doesn't work for anonymous users. I would need to build a test application that mimics our situation. I will send the oml as soon as possible. 

Thank you,

Michael

Hello,

We are facing the same problem with the cameplugin, the app crashes in an Android version 10, and we have the latest version 7.1.8.

Have uninstall and reinstall the app from the device with a new apk. 

Can´t uninstall the plugin from Outsystems?

Br,

Linda

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.