Android Question Minimum android version for Camera2

ThePuiu

Active Member
Licensed User
Longtime User
There is a minimum version of the operating system to be able to use the Camera2 library?

I tried on a tablet with Android 4.1 and it gives the following error message:
B4X:
Logger connected to:  samsung GT-P6800
** Activity (photo) Create, isFirst = true **
camex2_class_globals (java line: 144)
java.lang.VerifyError: anywheresoftware/b4a/objects/Camera2
    at xxi.smartcityhall.camex2._class_globals(camex2.java:144)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
    at xxi.smartcityhall.camex2.innerInitialize(camex2.java:23)
    at xxi.smartcityhall.camex2._initialize(camex2.java:710)
    at xxi.smartcityhall.photo._activity_create(photo.java:390)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
    at xxi.smartcityhall.photo.afterFirstLayout(photo.java:105)
    at xxi.smartcityhall.photo.access$000(photo.java:17)
    at xxi.smartcityhall.photo$WaitForLayout.run(photo.java:83)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4947)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
    at dalvik.system.NativeStart.main(Native Method)
--------- beginning of /dev/log/system
Then I tried on an ASUS ZenPad tablet with Android 5.0.2 where it didn't give an error message but it didn't work either! but at line:
B4X:
Wait For(PrepareSurface) Complete (Success As Boolean)
return Limited

On Android 9 the code works without problems.
 

DonManfred

Expert
Licensed User
Longtime User
Camera2 library is based on the newer Camera API introduced in Android 5 (API 21). It is therefore supported by Android 5+ devices.
It requires B4A v7.3+.
 
Upvote 0
Top