Android Question AppCompat crash on Android 8 [SOLVED]


Active Member
Licensed User
Longtime User
Hi guys,

I have question, maybe a stupid one ?

running the non modified example from Erel (b4a_b4xdrawer-zip.95460) on my Android 8 test device I get this error...... any idea why?

Logger connected to:  HUAWEI PRA-LX1
--------- beginning of crash
Fatal signal 6 (SIGABRT), code -6 in tid 31933 (RenderThread)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'HUAWEI/PRA-LX1/HWPRA-H:8.0.0/HUAWEIPRA-LX1/384(C02):user/release-keys'
Revision: '0'
ABI: 'arm64'
pid: 31911, tid: 31933, name: RenderThread  >>> b4a.example <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
Abort message: 'Failed to create EGLSurface for window 0x7bc41c7010, eglErr = EGL_BAD_ALLOC'
    x0   0000000000000000  x1   0000000000007cbd  x2   0000000000000006  x3   0000000000000008
    x4   0000000000000000  x5   0000000000000000  x6   0000000000000000  x7   7f7f7f7f7f7f7f7f
    x8   0000000000000083  x9   9b8866d9da7ebe18  x10  0000000000000000  x11  0000000000000001
    x12  ffffffffffffffff  x13  ffffffffffffffff  x14  ff00000000000000  x15  ffffffffffffffff
    x16  0000007bc86582d0  x17  0000007bc85f9800  x18  0000000000000000  x19  0000000000007ca7
    x20  0000000000007cbd  x21  0000007bb5b7ba80  x22  0000007ba5678c98  x23  0000007bc57b90fc
    x24  0000007bc57b9060  x25  7fffffffffffffff  x26  0000007ba6e7a338  x27  0000007bc408ef30
    x28  7fffffffffffffff  x29  0000007ba6e79cf0  x30  0000007bc85acb54
    sp   0000007ba6e79cb0  pc   0000007bc85f9808  pstate 0000000060000000
    #00 pc 000000000006a808  /system/lib64/ (tgkill+8)
    #01 pc 000000000001db50  /system/lib64/ (abort+88)
    #02 pc 0000000000007f4c  /system/lib64/ (__android_log_assert+304)
    #03 pc 000000000004e314  /system/lib64/ (_ZN7android10uirenderer12renderthread10EglManager13createSurfaceEP13ANativeWindow+192)
    #04 pc 000000000004c790  /system/lib64/ (_ZN7android10uirenderer12renderthread14OpenGLPipeline10setSurfaceEPNS_7SurfaceENS1_12SwapBehaviorE+64)
    #05 pc 00000000000492b4  /system/lib64/ (_ZN7android10uirenderer12renderthread13CanvasContext10setSurfaceEPNS_7SurfaceE+140)
    #06 pc 0000000000051344  /system/lib64/ (_ZN7android10uirenderer12renderthreadL20Bridge_updateSurfaceEPNS1_17updateSurfaceArgsE+16)
    #07 pc 0000000000052fc4  /system/lib64/ (_ZN7android10uirenderer12renderthread22MethodInvokeRenderTask3runEv+24)
    #08 pc 0000000000053f1c  /system/lib64/ (_ZN7android10uirenderer12renderthread12RenderThread10threadLoopEv+348)
    #09 pc 0000000000011670  /system/lib64/ (_ZN7android6Thread11_threadLoopEPv+280)
    #10 pc 00000000000bd4a8  /system/lib64/ (_ZN7android14AndroidRuntime15javaThreadShellEPv+136)
    #11 pc 00000000000671b8  /system/lib64/ (_ZL15__pthread_startPv+36)
    #12 pc 000000000001eee4  /system/lib64/ (__start_thread+68)
--------- beginning of system
--------- beginning of main
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 0 (B4XDrawer)
java.lang.RuntimeException: java.lang.ClassCastException: b4a.example.main cannot be cast to
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(
    at anywheresoftware.b4a.objects.PanelWrapper.LoadLayout(
    at anywheresoftware.b4a.objects.B4XViewWrapper.LoadLayout(
    at b4a.example.main._activity_create(
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(
    at b4a.example.main.afterFirstLayout(
    at b4a.example.main.access$000(
    at b4a.example.main$
    at android.os.Handler.handleCallback(
    at android.os.Handler.dispatchMessage(
    at android.os.Looper.loop(
    at java.lang.reflect.Method.invoke(Native Method)
Caused by: java.lang.ClassCastException: b4a.example.main cannot be cast to
    at de.amberhome.objects.appcompat.ACToolBarWrapper.DesignerCreateView(
    at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(
    ... 19 more
** Activity (main) Resume **
Copying updated assets files (1)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Create, isFirst = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **


Licensed User
Longtime User
Where is the relevant main activity code?
Upvote 0


Active Member
Licensed User
Longtime User
as said, non modified example from Erel

#Region  Project Attributes
    #ApplicationLabel: B4A Example
    #VersionCode: 1
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region
Sub Process_Globals

End Sub

Sub Globals
    Private ACToolBarLight1 As ACToolBarLight
    Private ToolbarHelper As ACActionBar
    Private Drawer As B4XDrawer
    Private ListView1 As ListView
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Drawer.Initialize(Me, "Drawer", Activity, 300dip)
    ToolbarHelper.ShowUpIndicator = True 'set to true to show the up arrow
    Dim bd As BitmapDrawable
    bd.Initialize(LoadBitmap(File.DirAssets, "hamburger.png"))
    ToolbarHelper.UpIndicatorDrawable =  bd
    For i = 1 To 30
        ListView1.AddSingleLine("Item " & i)

End Sub

Sub ACToolBarLight1_NavigationItemClick
    Drawer.LeftOpen = Not(Drawer.LeftOpen)
End Sub

Sub Activity_KeyPress (KeyCode As Int) As Boolean
    If KeyCode = KeyCodes.KEYCODE_BACK And Drawer.LeftOpen Then
        Drawer.LeftOpen = False
        Return True
    End If
    Return False
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information:
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="29"/>
<supports-screens android:largeScreens="true"
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.

SetApplicationAttribute(android:theme, "@style/MyAppTheme")

CreateResource(values, theme.xml,
    <style name="MyAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimary">#0098FF</item>
        <item name="colorPrimaryDark">#007CF5</item>
        <item name="colorAccent">#AAAA00</item>
        <item name="windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
        <item name="android:windowTranslucentNavigation">false</item>
         <item name="android:windowTranslucentStatus">true</item>
Upvote 0


Active Member
Licensed User
Longtime User
it is somehow related to the crappy HUAWEI phone with Android 8. ( C02)

the exact same APK runs on different Sony Android 8 phones without a problem
Upvote 0


Active Member
Licensed User
Longtime User
little update, wiped the HUAWEI P10 lite and ..... it is working now - very strange
Upvote 0