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.
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
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