Android Question Camera2 example crashed

toby

Well-Known Member
Licensed User
Longtime User
I use this example without any change.

Error occurred in the following function:
B4X:
Public Sub getSupportedHardwareLevel As String
    Dim jo As JavaObject = Camera.GetCameraCharacteristics(0) '<---this line caused the crash'
    Return IntToConst(jo.RunMethod("get", Array(StaticCameraCharacteristics.GetField("INFO_SUPPORTED_HARDWARE_LEVEL"))), SUPPORTED_HARDWARE_LEVEL)
End Sub
B4A 10.5, Windows 10 64Bit, Zenfone 5, Android 9

Could someone kindly show me how to fix the error? I searched the forum and I was surprised that no one else reported this problem.

By the way, the sample example works with Samsung Tab E, Android 7.1.1, and above function prints out "LEGACY".

Logger connected to: asus ASUS_X017DA
--------- beginning of main
Not starting debugger since process cannot load the jdwp agent.
Connecting to perf service.
SetAppTypeFace- try to flip, app = com.ddg.camera2
Typeface getFontPathFlipFont - systemFont = default#default
SetAppTypeFace- try to flip, app = com.ddg.camera2
Typeface getFontPathFlipFont - systemFont = default#default
Class anywheresoftware.b4a.BA failed lock verification and will run slower.
Common causes for lock verification issues are non-optimized dex code
and incorrect proguard optimizations.
common created.
Starting remote logger. Port: 15174
Skia GL Pipeline
QUALCOMM build : cf57c9c, I1cb5c4d1cc
Build Date : 10/15/18
OpenGL ES Shader Compiler Version: EV031.25.03.01
Local Branch :
Remote Branch : refs/tags/AU_LINUX_ANDROID_LA.UM.7.2.R1.09.00.00.442.049
Remote Branch : NONE
Reconstruct Branch : NOTHING
Build Config : S L 6.0.7 AArch64
Loading /vendor/lib64/hw/gralloc.sdm660.so from current namespace instead of sphal namespace.
type=1400 audit(0.0:347): avc: denied { search } for name="proc" dev="debugfs" ino=5072 scontext=u:r:untrusted_app:s0:c169,c256,c512,c768 tcontext=u:eek:bject_r:qti_debugfs:s0 tclass=dir permissive=0
PFP: 0x005ff110, ME: 0x005ff066
android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
Initialized EGL, version 1.4
Swap behavior 2
*** Debugger waiting for connection (0) ***
ignoring event: create_menu
Loading /vendor/lib64/hw/[email protected] from current namespace instead of sphal namespace.
Loading /vendor/lib64/hw/gralloc.sdm660.so from current namespace instead of sphal namespace.
*** Debugger waiting for connection (1) ***
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Class androidx.core.content.ContextCompat failed lock verification and will run slower.
After accept
Connecting to camera service
type=1400 audit(0.0:348): avc: denied { read } for name="u:eek:bject_r:vendor_camera_prop:s0" dev="tmpfs" ino=18548 scontext=u:r:untrusted_app:s0:c169,c256,c512,c768 tcontext=u:eek:bject_r:vendor_camera_prop:s0 tclass=file permissive=0
uid=10169(com.ddg.camera2) identical 1 line
type=1400 audit(0.0:350): avc: denied { read } for name="u:eek:bject_r:vendor_camera_prop:s0" dev="tmpfs" ino=18548 scontext=u:r:untrusted_app:s0:c169,c256,c512,c768 tcontext=u:eek:bject_r:vendor_camera_prop:s0 tclass=file permissive=0
Access denied finding property "vendor.camera.aux.packagelist"
uid=10169(com.ddg.camera2) identical 1 line
Access denied finding property "vendor.camera.aux.packagelist"
[soar.cts] ignore the status update of camera: 2
Access denied finding property "vendor.camera.aux.packagelist"
[soar.cts] ignore the status update of camera: 3
type=1400 audit(0.0:351): avc: denied { read } for name="u:eek:bject_r:vendor_camera_prop:s0" dev="tmpfs" ino=18548 scontext=u:r:untrusted_app:s0:c169,c256,c512,c768 tcontext=u:eek:bject_r:vendor_camera_prop:s0 tclass=file permissive=0
Access denied finding property "vendor.camera.aux.packagelist"
uid=10169(com.ddg.camera2) identical 1 line
Access denied finding property "vendor.camera.aux.packagelist"
ignore the torch status update of camera: 2
Access denied finding property "vendor.camera.aux.packagelist"
ignore the torch status update of camera: 3
type=1400 audit(0.0:352): avc: denied { read } for name="u:eek:bject_r:vendor_camera_prop:s0" dev="tmpfs" ino=18548 scontext=u:r:untrusted_app:s0:c169,c256,c512,c768 tcontext=u:eek:bject_r:vendor_camera_prop:s0 tclass=file permissive=0
uid=10169(com.ddg.camera2) identical 2 lines
type=1400 audit(0.0:355): avc: denied { read } for name="u:eek:bject_r:vendor_camera_prop:s0" dev="tmpfs" ino=18548 scontext=u:r:untrusted_app:s0:c169,c256,c512,c768 tcontext=u:eek:bject_r:vendor_camera_prop:s0 tclass=file permissive=0
Error occurred on line: 83 (CamEx2)
java.lang.RuntimeException: Camera is being used after Camera.release() was called
at android.hardware.Camera._enableShutterSound(Native Method)
at android.hardware.Camera.updateAppOpsPlayAudio(Camera.java:1964)
at android.hardware.Camera.initAppOps(Camera.java:755)
at android.hardware.Camera.<init>(Camera.java:748)
at android.hardware.Camera.getEmptyParameters(Camera.java:2362)
at android.hardware.camera2.legacy.LegacyMetadataMapper.createCharacteristics(LegacyMetadataMapper.java:151)
at android.hardware.camera2.CameraManager.getCameraCharacteristics(CameraManager.java:277)
at anywheresoftware.b4a.objects.Camera2.GetCameraCharacteristics(Camera2.java:210)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:262)
at com.ddg.camera2.b4xmainpage._b4xpage_created(b4xmainpage.java:82)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:318)
at anywheresoftware.b4a.debug.Debug.CallSubNew2(Debug.java:285)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.keywords.Common.CallSubDebug2(Common.java:1055)
at com.ddg.camera2.b4xpagesmanager._createpageifneeded(b4xpagesmanager.java:1040)
at com.ddg.camera2.b4xpagesmanager._showpage(b4xpagesmanager.java:400)
at com.ddg.camera2.b4xpagesmanager._addpage(b4xpagesmanager.java:228)
at com.ddg.camera2.b4xpagesmanager._addpageandcreate(b4xpagesmanager.java:242)
at com.ddg.camera2.b4xpagesmanager._initialize(b4xpagesmanager.java:163)
at com.ddg.camera2.main._activity_create(main.java:418)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at com.ddg.camera2.main.afterFirstLayout(main.java:105)
at com.ddg.camera2.main.access$000(main.java:17)
at com.ddg.camera2.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:198)
at android.app.ActivityThread.main(ActivityThread.java:6732)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
null: 161
java.net.SocketException: Socket closed
at java.net.SocketInputStream.read(SocketInputStream.java:209)
at java.net.SocketInputStream.read(SocketInputStream.java:144)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:248)
at java.io.BufferedInputStream.read(BufferedInputStream.java:267)
at anywheresoftware.b4a.shell.ShellConnector.readControlData(ShellConnector.java:191)
at anywheresoftware.b4a.shell.ShellConnector.connect(ShellConnector.java:186)
at anywheresoftware.b4a.shell.ShellConnector.run(ShellConnector.java:119)
at java.lang.Thread.run(Thread.java:764)
System.exit called, status: 0
VM exiting with result code 0, cleanup skipped.
Not starting debugger since process cannot load the jdwp agent.
Connecting to perf service.
SetAppTypeFace- try to flip, app = com.ddg.camera2
Typeface getFontPathFlipFont - systemFont = default#default
SetAppTypeFace- try to flip, app = com.ddg.camera2
Typeface getFontPathFlipFont - systemFont = default#default
Class anywheresoftware.b4a.BA failed lock verification and will run slower.
Common causes for lock verification issues are non-optimized dex code
and incorrect proguard optimizations.
common created.
Starting remote logger. Port: 15174
Skia GL Pipeline
QUALCOMM build : cf57c9c, I1cb5c4d1cc
Build Date : 10/15/18
OpenGL ES Shader Compiler Version: EV031.25.03.01
Local Branch :
Remote Branch : refs/tags/AU_LINUX_ANDROID_LA.UM.7.2.R1.09.00.00.442.049
Remote Branch : NONE
Reconstruct Branch : NOTHING
Build Config : S L 6.0.7 AArch64
Loading /vendor/lib64/hw/gralloc.sdm660.so from current namespace instead of sphal namespace.
type=1400 audit(0.0:364): avc: denied { search } for name="proc" dev="debugfs" ino=5072 scontext=u:r:untrusted_app:s0:c169,c256,c512,c768 tcontext=u:eek:bject_r:qti_debugfs:s0 tclass=dir permissive=0
PFP: 0x005ff110, ME: 0x005ff066
*** Debugger waiting for connection (0) ***
android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
Initialized EGL, version 1.4
Swap behavior 2
ignoring event: create_menu
Loading /vendor/lib64/hw/[email protected] from current namespace instead of sphal namespace.
Loading /vendor/lib64/hw/gralloc.sdm660.so from current namespace instead of sphal namespace.
*** Debugger waiting for connection (1) ***
After accept
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Class androidx.core.content.ContextCompat failed lock verification and will run slower.
Connecting to camera service
type=1400 audit(0.0:365): avc: denied { read } for name="u:eek:bject_r:vendor_camera_prop:s0" dev="tmpfs" ino=18548 scontext=u:r:untrusted_app:s0:c169,c256,c512,c768 tcontext=u:eek:bject_r:vendor_camera_prop:s0 tclass=file permissive=0
Access denied finding property "vendor.camera.aux.packagelist"
uid=10169(com.ddg.camera2) identical 1 line
Access denied finding property "vendor.camera.aux.packagelist"
[soar.cts] ignore the status update of camera: 2
Access denied finding property "vendor.camera.aux.packagelist"
[soar.cts] ignore the status update of camera: 3
Access denied finding property "vendor.camera.aux.packagelist"
uid=10169(com.ddg.camera2) Binder:9215_3 identical 1 line
Access denied finding property "vendor.camera.aux.packagelist"
ignore the torch status update of camera: 2
Access denied finding property "vendor.camera.aux.packagelist"
type=1400 audit(0.0:366): avc: denied { read } for name="u:eek:bject_r:vendor_camera_prop:s0" dev="tmpfs" ino=18548 scontext=u:r:untrusted_app:s0:c169,c256,c512,c768 tcontext=u:eek:bject_r:vendor_camera_prop:s0 tclass=file permissive=0
ignore the torch status update of camera: 3
type=1400 audit(0.0:367): avc: denied { read } for name="u:eek:bject_r:vendor_camera_prop:s0" dev="tmpfs" ino=18548 scontext=u:r:untrusted_app:s0:c169,c256,c512,c768 tcontext=u:eek:bject_r:vendor_camera_prop:s0 tclass=file permissive=0
type=1400 audit(0.0:368): avc: denied { read } for name="u:eek:bject_r:vendor_camera_prop:s0" dev="tmpfs" ino=18548 scontext=u:r:untrusted_app:s0:c169,c256,c512,c768 tcontext=u:eek:bject_r:vendor_camera_prop:s0 tclass=file permissive=0
type=1400 audit(0.0:369): avc: denied { read } for name="u:eek:bject_r:vendor_camera_prop:s0" dev="tmpfs" ino=18548 scontext=u:r:untrusted_app:s0:c169,c256,c512,c768 tcontext=u:eek:bject_r:vendor_camera_prop:s0 tclass=file permissive=0
Error occurred on line: 83 (CamEx2)
java.lang.RuntimeException: Camera is being used after Camera.release() was called
at android.hardware.Camera._enableShutterSound(Native Method)
at android.hardware.Camera.updateAppOpsPlayAudio(Camera.java:1964)
at android.hardware.Camera.initAppOps(Camera.java:755)
at android.hardware.Camera.<init>(Camera.java:748)
at android.hardware.Camera.getEmptyParameters(Camera.java:2362)
at android.hardware.camera2.legacy.LegacyMetadataMapper.createCharacteristics(LegacyMetadataMapper.java:151)
at android.hardware.camera2.CameraManager.getCameraCharacteristics(CameraManager.java:277)
at anywheresoftware.b4a.objects.Camera2.GetCameraCharacteristics(Camera2.java:210)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:262)
at com.ddg.camera2.b4xmainpage._b4xpage_created(b4xmainpage.java:82)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:318)
at anywheresoftware.b4a.debug.Debug.CallSubNew2(Debug.java:285)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.keywords.Common.CallSubDebug2(Common.java:1055)
at com.ddg.camera2.b4xpagesmanager._createpageifneeded(b4xpagesmanager.java:1040)
at com.ddg.camera2.b4xpagesmanager._showpage(b4xpagesmanager.java:400)
at com.ddg.camera2.b4xpagesmanager._addpage(b4xpagesmanager.java:228)
at com.ddg.camera2.b4xpagesmanager._addpageandcreate(b4xpagesmanager.java:242)
at com.ddg.camera2.b4xpagesmanager._initialize(b4xpagesmanager.java:163)
at com.ddg.camera2.main._activity_create(main.java:418)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at com.ddg.camera2.main.afterFirstLayout(main.java:105)
at com.ddg.camera2.main.access$000(main.java:17)
at com.ddg.camera2.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:198)
at android.app.ActivityThread.main(ActivityThread.java:6732)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
null: 130
java.net.SocketException: Socket closed
at java.net.SocketInputStream.read(SocketInputStream.java:209)
at java.net.SocketInputStream.read(SocketInputStream.java:144)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:248)
at java.io.BufferedInputStream.read(BufferedInputStream.java:267)
at anywheresoftware.b4a.shell.ShellConnector.readControlData(ShellConnector.java:191)
at anywheresoftware.b4a.shell.ShellConnector.connect(ShellConnector.java:186)
at anywheresoftware.b4a.shell.ShellConnector.run(ShellConnector.java:119)
at java.lang.Thread.run(Thread.java:764)
 

MikeSW17

Active Member
Licensed User
It compiles and runs OK here, on Samsung S20, Android 11, B4A 10.5, OpenJDK and SDK versions as recommended.
From a newbie point of view, your Log seems to suggest a Permissions problem?
 
Upvote 0
Top