Build 3644 - Accessing Camera on Android crashes

Accessing the camera crashes the app on build 2021.3644. I’ve attached a tiny sample project at the end. I’ve tested this on Android 8.1 with Solar2D builds 2021.3642 and 2021.3644.

On 2021.3642, there are no issues. When you first launch the app and press the rectangle, the app requests camera access. After it has received access and you press the rect again, it opens the camera.

On 2021.3644, however, after you’ve received camera access and press the rect again, the app crashes.

Camera Test.zip (66.8 KB)

As a result of the comment from @XeduR , I tried one of my apps that uses the camera, compiled with build 3644 and when trying to access the camera it gave an error. tested on Android 11

Hi @vlads , any news about this issue?

Looking into it.

@vlads, any news?

Hi @XeduR, have you been able to find a solution to this problem?

Hey @orangegstudios!

There’s no solution yet. If you are using version 3644 or newer, then you need to avoid accessing camera until @vlads gets a fix rolled out.

Hey! I wanted to ask some help with this. Can you please post stacktraces and exceptions it fails with? I am unable to repro the bug :frowning:

05-17 15:51:06.706 13543 13543 D AndroidRuntime: Shutting down VM
05-17 15:51:06.706 13543 13543 E AndroidRuntime: FATAL EXCEPTION: main
05-17 15:51:06.706 13543 13543 E AndroidRuntime: Process: com.solar2d.app.Camera_Test, PID: 13543
05-17 15:51:06.706 13543 13543 E AndroidRuntime: java.lang.IllegalArgumentException
05-17 15:51:06.706 13543 13543 E AndroidRuntime:        at com.ansca.corona.storage.FileContentProvider.createContentUriForFile(FileContentProvider.java:446)
05-17 15:51:06.706 13543 13543 E AndroidRuntime:        at com.ansca.corona.CoronaActivity.showCameraWindowForImage(CoronaActivity.java:2758)
05-17 15:51:06.706 13543 13543 E AndroidRuntime:        at com.ansca.corona.CoronaShowApiHandler.showCameraWindowForImage(CoronaShowApiHandler.java:37)
05-17 15:51:06.706 13543 13543 E AndroidRuntime:        at com.ansca.corona.Controller$15.run(Controller.java:1588)
05-17 15:51:06.706 13543 13543 E AndroidRuntime:        at android.os.Handler.handleCallback(Handler.java:873)
05-17 15:51:06.706 13543 13543 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:99)
05-17 15:51:06.706 13543 13543 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:235)
05-17 15:51:06.706 13543 13543 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:6760)
05-17 15:51:06.706 13543 13543 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
05-17 15:51:06.706 13543 13543 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
05-17 15:51:06.706 13543 13543 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911)
05-17 15:51:06.709   941  4293 W ActivityManager:   Force finishing activity com.solar2d.app.Camera_Test/com.ansca.corona.CoronaActivity
05-17 15:51:06.713   941  4293 I PowerWrap: PowerHal_Wrap_mtkPowerHint
05-17 15:51:06.713   941  4293 I chatty  : uid=1000(system) Binder:941_1B identical 1 line
05-17 15:51:06.713   941  4293 I PowerWrap: PowerHal_Wrap_mtkPowerHint
05-17 15:51:06.715   447   463 I libPowerHal: 15: cpu_ctrl set freq: -1 -1 -1 -1
05-17 15:51:06.716   447   463 I libPowerHal: 16: cpu_ctrl set freq: 2001000 -1 1500000 -1
05-17 15:51:06.718   941   960 D ActivityManager: Dis crash alert for the backgroud app, proc : ProcessRecord{8e3ff0b 13543:com.solar2d.app.Camera_Test/u0a123} proc.uid:10123
05-17 15:51:06.718   941   960 W ActivityManager: Skipping crash dialog of ProcessRecord{8e3ff0b 13543:com.solar2d.app.Camera_Test/u0a123}: background
05-17 15:51:06.719 13543 13543 I Process : Sending signal. PID: 13543 SIG: 9
05-17 15:51:06.721   941   959 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.stats.service.DropBoxEntryAddedReceiver
05-17 15:51:06.722   941   959 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver
05-17 15:51:06.733   941  1325 V AlarmManager: operation:PendingIntent{d5180e7: PendingIntentRecord{aa47494 com.google.android.gms startService}} triggerAtTime too large, abondon 315361638973
05-17 15:51:06.739   941  1037 W InputDispatcher: channel '3d12182 com.solar2d.app.Camera_Test/com.ansca.corona.CoronaActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
05-17 15:51:06.739   941  1037 E InputDispatcher: channel '3d12182 com.solar2d.app.Camera_Test/com.ansca.corona.CoronaActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
05-17 15:51:06.740   528   528 I Accelerometer: enable: handle:0, en:0
05-17 15:51:06.740   460  1162 I SurfaceFlinger: [SF client] Remove(0xadad7db0) for (6619251:)
05-17 15:51:06.743   941  1317 I ActivityManager: Process com.solar2d.app.Camera_Test (pid 13543) has died: vis  +99TOP
05-17 15:51:06.743   941  4293 I WindowManager: WIN DEATH: Window{3d12182 u0 com.solar2d.app.Camera_Test/com.ansca.corona.CoronaActivity}
05-17 15:51:06.743   941  4293 V WindowManager: Remove Window{3d12182 u0 com.solar2d.app.Camera_Test/com.ansca.corona.CoronaActivity} client=aae34cd, surfaceController=Surface(name=com.solar2d.app.Camera_Test/com.ansca.corona.CoronaActivity)/@0x202eb3d Callers=com.android.server.wm.WindowState.access$300:222 com.android.server.wm.WindowState$DeathRecipient.binderDied:2477 android.os.BinderProxy.sendDeathNotice:1371 <bottom of call stack> <bottom of call stack>
05-17 15:51:06.743   941  4293 W InputDispatcher: Attempted to unregister already unregistered input channel '3d12182 com.solar2d.app.Camera_Test/com.ansca.corona.CoronaActivity (server)'
05-17 15:51:06.745   941   962 W libprocessgroup: kill(-13543, 9) failed: No such process
05-17 15:51:06.745   941   962 I libprocessgroup: Successfully killed process cgroup uid 10123 pid 13543 in 2ms
05-17 15:51:06.745   941  4293 V WindowManager: Changing focus from Window{3d12182 u0 com.solar2d.app.Camera_Test/com.ansca.corona.CoronaActivity EXITING} to null Callers=com.android.server.wm.WindowState.setupWindowForRemoveOnExit:2122 com.android.server.wm.WindowState.removeIfPossible:2093 com.android.server.wm.WindowState.access$300:222 com.android.server.wm.WindowState$DeathRecipient.binderDied:2477
05-17 15:51:06.746   941  4293 D WindowManager: Input focus has changed to null
05-17 15:51:06.758   941   968 I WindowManager: Focus moving from Window{3d12182 u0 com.solar2d.app.Camera_Test/com.ansca.corona.CoronaActivity EXITING} to null

Here’s a snippet. Hopefully it’ll help.

1 Like
05-19 11:17:15.260 24793 24793 E AndroidRuntime: FATAL EXCEPTION: main
05-19 11:17:15.260 24793 24793 E AndroidRuntime: Process: se.appfamily.puzzle.unicorns.free, PID: 24793
05-19 11:17:15.260 24793 24793 E AndroidRuntime: java.lang.IllegalArgumentException
05-19 11:17:15.260 24793 24793 E AndroidRuntime:        at com.ansca.corona.storage.FileContentProvider.createContentUriForFile(FileContentProvider.java:446)
05-19 11:17:15.260 24793 24793 E AndroidRuntime:        at com.ansca.corona.CoronaActivity.showCameraWindowForImage(CoronaActivity.java:2758)
05-19 11:17:15.260 24793 24793 E AndroidRuntime:        at com.ansca.corona.CoronaShowApiHandler.showCameraWindowForImage(CoronaShowApiHandler.java:37)
05-19 11:17:15.260 24793 24793 E AndroidRuntime:        at com.ansca.corona.Controller$15.run(Controller.java:1588)
05-19 11:17:15.260 24793 24793 E AndroidRuntime:        at android.os.Handler.handleCallback(Handler.java:790)
05-19 11:17:15.260 24793 24793 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:99)
05-19 11:17:15.260 24793 24793 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:164)
05-19 11:17:15.260 24793 24793 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:6494)
05-19 11:17:15.260 24793 24793 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
05-19 11:17:15.260 24793 24793 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
05-19 11:17:15.260 24793 24793 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
05-19 11:17:15.260   399   594 V MediaRouterService: restoreBluetoothA2dp(false)
05-19 11:17:15.261   399 25602 V MediaRouterService: restoreBluetoothA2dp(false)
05-19 11:17:15.266   399   594 W ActivityManager:   Force finishing activity se.appfamily.puzzle.unicorns.free/com.ansca.corona.CoronaActivity
05-19 11:17:15.269   399   414 I ActivityManager: Showing crash dialog for package se.appfamily.puzzle.unicorns.free u0

Android 8.1 (SDK level 27)

Before this, when trying to take a photo, it is requesting permissions:

local hasAccessToCamera, hasCamera = media.hasSource( media.Camera )
if ( hasAccessToCamera == true ) then
	takePhoto()
elseif ( hasCamera == true and native.canShowPopup( "requestAppPermission" ) ) then
	native.showPopup( "requestAppPermission", {
		appPermission="Camera",
		listener = onPermissionComplete
	} )
end

New build is up. Please check if stuff is working. If not, also file an issue so I don’t loose track please

1 Like

It’s fixed. Thanks!

Seems that the issue still persists on Android 11 (no idea about Android 10).

I’ve created an issue in GitHub: https://github.com/coronalabs/corona/issues/258

Are you still experiencing issues with this, @orangegstudios?

Hi, Android 10 and build 2021.3646 OK, work your Camera.Test.zip

regards,

solca

1 Like