No graphics working on Huawei P7-L10 with SDL 2.24.0

My SDL game has always worked on all the emulators on Android Studio, and my old test Huawei P7-L10 device too. But, after updating to SDL 2.24.0 and SDL2_image 2.6.2 it now shows no graphics on the device’s screen at all (I just get a black screen), but it still works fine on the emulators. The game is running on the Huawei device, plays sounds and responds to screen taps, but no images are shown. SDL 2.18.0 works fine on it.

Is there a minimum Android OS needed nowadays? (my device has 4.4.2).

I think this should be fine with android 4.4.2 ! maybe create an issue on github.
can you provide a log cat ?
can you reduce the issue to a basic test case: creating renderer + clear screen with a color ?

Thanks Sylvain, I’ve tried connecting my Huawei device and then hit the Debug button on Android Studio. A dialog box appears eventually on the device saying “Waiting For Debugger”. If I then click on the “Attach Debugger to Android Process” button in Android Studio, it then straight away pops up a tooltip saying “Debugger process finished with exit code 1”

I’m not an Android expert so I don’t know if I’m doing something wrong here!

You don’t need to attach a debugger, just collect the trace (“adb logcat” with the command line).
Also, try with a smaller testcase (just clear screen). are you using SDL_Renderer or pure gl command?

I’m not sure how to do adb logcat with a command line, but this is the output from the logcat windowif that’s the same thing:

2022-10-18 16:53:14.552 11487-11487/? E/dalvikvm: could not disable core file generation for pid 11487: Operation not permitted
2022-10-18 16:53:14.632 11487-11487/? I/dalvikvm: Could not find method android.view.PointerIcon.create, referenced from method org.libsdl.app.SDLActivity.createCustomCursor
2022-10-18 16:53:14.632 11487-11487/? W/dalvikvm: VFY: unable to resolve static method 236: Landroid/view/PointerIcon;.create (Landroid/graphics/Bitmap;FF)Landroid/view/PointerIcon;
2022-10-18 16:53:14.642 11487-11487/? I/dalvikvm: Could not find method android.app.Activity.checkSelfPermission, referenced from method org.libsdl.app.SDLActivity.requestPermission
2022-10-18 16:53:14.642 11487-11487/? W/dalvikvm: VFY: unable to resolve virtual method 1: Landroid/app/Activity;.checkSelfPermission (Ljava/lang/String;)I
2022-10-18 16:53:14.642 11487-11487/? I/dalvikvm: Could not find method org.libsdl.app.SDLSurface.setPointerIcon, referenced from method org.libsdl.app.SDLActivity.setCustomCursor
2022-10-18 16:53:14.642 11487-11487/? W/dalvikvm: VFY: unable to resolve virtual method 811: Lorg/libsdl/app/SDLSurface;.setPointerIcon (Landroid/view/PointerIcon;)V
2022-10-18 16:53:14.642 11487-11487/? I/dalvikvm: Could not find method org.libsdl.app.SDLSurface.setPointerIcon, referenced from method org.libsdl.app.SDLActivity.setSystemCursor
2022-10-18 16:53:14.642 11487-11487/? W/dalvikvm: VFY: unable to resolve virtual method 811: Lorg/libsdl/app/SDLSurface;.setPointerIcon (Landroid/view/PointerIcon;)V
2022-10-18 16:53:14.642 11487-11487/? I/dalvikvm: Could not find method android.content.res.Configuration.getLocales, referenced from method org.libsdl.app.SDLActivity.onCreate
2022-10-18 16:53:14.642 11487-11487/? W/dalvikvm: VFY: unable to resolve virtual method 98: Landroid/content/res/Configuration;.getLocales ()Landroid/os/LocaleList;
2022-10-18 16:53:14.702 11487-11487/com.windowsgames.firefight I/dalvikvm: Could not find method android.media.AudioTrack.write, referenced from method org.libsdl.app.SDLAudioManager.audioWriteFloatBuffer
2022-10-18 16:53:14.702 11487-11487/com.windowsgames.firefight W/dalvikvm: VFY: unable to resolve virtual method 157: Landroid/media/AudioTrack;.write ([FIII)I
2022-10-18 16:53:14.702 11487-11487/com.windowsgames.firefight I/dalvikvm: Could not find method android.media.AudioRecord.read, referenced from method org.libsdl.app.SDLAudioManager.captureReadByteBuffer
2022-10-18 16:53:14.702 11487-11487/com.windowsgames.firefight W/dalvikvm: VFY: unable to resolve virtual method 140: Landroid/media/AudioRecord;.read ([BIII)I
2022-10-18 16:53:14.702 11487-11487/com.windowsgames.firefight I/dalvikvm: Could not find method android.media.AudioRecord.read, referenced from method org.libsdl.app.SDLAudioManager.captureReadFloatBuffer
2022-10-18 16:53:14.702 11487-11487/com.windowsgames.firefight W/dalvikvm: VFY: unable to resolve virtual method 141: Landroid/media/AudioRecord;.read ([FIII)I
2022-10-18 16:53:14.702 11487-11487/com.windowsgames.firefight I/dalvikvm: Could not find method android.media.AudioRecord.read, referenced from method org.libsdl.app.SDLAudioManager.captureReadShortBuffer
2022-10-18 16:53:14.702 11487-11487/com.windowsgames.firefight W/dalvikvm: VFY: unable to resolve virtual method 143: Landroid/media/AudioRecord;.read ([SIII)I
2022-10-18 16:53:14.712 11487-11487/com.windowsgames.firefight I/dalvikvm: Could not find method org.libsdl.app.SDLActivity.isInMultiWindowMode, referenced from method org.libsdl.app.SDLSurface.surfaceChanged
2022-10-18 16:53:14.712 11487-11487/com.windowsgames.firefight W/dalvikvm: VFY: unable to resolve virtual method 615: Lorg/libsdl/app/SDLActivity;.isInMultiWindowMode ()Z
2022-10-18 16:53:14.782 11487-11487/com.windowsgames.firefight W/linker: library "libmaliinstr.so" not found
2022-10-18 16:53:14.782 11487-11487/com.windowsgames.firefight W/linker: error:
2022-10-18 16:53:14.872 11487-11520/com.windowsgames.firefight W/libOpenSLES: class OutputMix interface 0 requested but unavailable MPH=43
2022-10-18 16:53:14.912 11487-11520/com.windowsgames.firefight I/SDL/APP: pixel format wanted SDL_PIXELFORMAT_RGBX8888 (2), got SDL_PIXELFORMAT_RGBX8888 (2)

I’m only doing SDL_Renderer commands with none of my own OpenGL

the logcat seems ok to me, since it’s an old android version.
do you have more logcat after ?

in my code, I use:

   SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 0);
   SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
   SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6);
   SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);

does that help ?

Thanks for all your help Sylvain (again!) and I tried all day tweaking things but just couldn’t get anything to appear on the screen. I’ve given up, and reset my project to use SDL 2.0.20 and SDL_image 2.0.5 and everything immediately worked again.

If it’s possible to get SDL versions in between those I could try each one and see where it breaks. I’m not sure if those are still available though?

I don’t know if there’s an issue with the latest versions of SDL and/or SDL_image, or if it’s just some quirk with my old Huawei - but I’ve run out of time so I’m stuck with older SDL I guess.

BTW I used those SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5) etc… commands a few years back after you suggested them and I was having weird colour problems on some Samsung phones. I’d assumed that that problem had got fixed in later versions of SDL. Do you still recommend using those commands for Android?

Yes I still use those commands because it’s some gl parameters that seem to run better for android. and don’t have problem to consider changing it.
this is not something that could be fixed, but some kind of parameter. (maybe this could be default in android, though…).

Not sure how to help you. but again:

  • show the full log cat to find an error message that could give some hint. (so far, you log cat looks ok to me)
  • Try to reduce you app to a smaller test-case: create SDL_Renderer + basic stuffs.

latest SDL head version, is definitively ok for Android.

Huawei P7 has a ARM Mali-450 MP4 GPU graphical controller

I compiled my app with SDL commit version [99e9156ff59825f093da11b93c92e2f562752d04] (testgles2: Fix typo in help text)
and some android users responded me via Google Play console about black screen problems when app starts. After that I restored my app based on prev SDL version I used [5cbe62eac01cdf7256231b0f97824ed6c67c8f7b] (ignore vs2019 meta folder) and problem was solved.

These users have following devices:
Samsung Galaxy Tab A 7.0
Prestigio PMT3171_3G
DEXP E110
and all of them use Mali-400MP2 as graphical controller.

Unfortunately I do not have android devices with this controller and I cannot give any logs.

1 Like

Have you tried last SDL commit [aefc6b5bb57cd3aadc6964e26f2caac1d1c5f624] “Renamed variables, index is the singular of indices”?

And make sure your tools are updated: sdk, build tools, ndk, gradle, …

Setting the GL attributes when you’re using SDL_Renderer shouldn’t do anything, since SDL_Renderer sets its own attributes when in creates the GL/GLES context, and those will override anything you set before creating the renderer (and any that you set afterward won’t take effect since the GL context has already been created).

@sjr, no, this is wrong. Setting the GL attributes does change the EGL config that is going to be chosen. on some old device, this solved rendering issue, like black screen, red colors. (mostly bug on those device).

Weird, because in the code SDL_Renderer sets its own GL attributes before doing anything.

@sjr,
Attributes means lots of things. Indeed SDL_Renderer back-end will initialize itself, for instance GLES2 (since we’re on Android),

it actually may set SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_MAJOR_VERSION, SDL_GL_CONTEXT_MINOR_VERSION. It sets also various parameters.

Attributes like SDL_GL_RED_SIZE etc, get used in the EGL layer when choosing the config.

X11 video backend can also set them in some situation:

)

That’s my bad then, because I would’ve sworn that SDL_Renderer's GL backend set its own attributes for stuff like color channel sizes etc. Maybe it used to.

I’ve updated everything on Android Studio and tried again with SDL 2.24.0 and SDL_image 2.6.2 and I still get the same result of a blank screen.

If you want to try to get to the bottom of this I’d be happy to try out any test projects you’d like to send and see if they work on my Huawei - maybe send them via email to sean@windowsgames.co.uk?

That was all the output I got from Logcat. Here’s what I get now with the ‘updated logcat’:

---------------------------- PROCESS STARTED (2611) for package com.windowsgames.firefight ----------------------------
2022-10-20 11:37:13.400  2611-2611  dalvikvm                com.windowsgames.firefight           I  Could not find method android.view.PointerIcon.create, referenced from method org.libsdl.app.SDLActivity.createCustomCursor
2022-10-20 11:37:13.400  2611-2611  dalvikvm                com.windowsgames.firefight           W  VFY: unable to resolve static method 236: Landroid/view/PointerIcon;.create (Landroid/graphics/Bitmap;FF)Landroid/view/PointerIcon;
2022-10-20 11:37:13.410  2611-2611  dalvikvm                com.windowsgames.firefight           I  Could not find method android.app.Activity.checkSelfPermission, referenced from method org.libsdl.app.SDLActivity.requestPermission
2022-10-20 11:37:13.410  2611-2611  dalvikvm                com.windowsgames.firefight           W  VFY: unable to resolve virtual method 1: Landroid/app/Activity;.checkSelfPermission (Ljava/lang/String;)I
2022-10-20 11:37:13.410  2611-2611  dalvikvm                com.windowsgames.firefight           I  Could not find method org.libsdl.app.SDLSurface.setPointerIcon, referenced from method org.libsdl.app.SDLActivity.setCustomCursor
2022-10-20 11:37:13.410  2611-2611  dalvikvm                com.windowsgames.firefight           W  VFY: unable to resolve virtual method 811: Lorg/libsdl/app/SDLSurface;.setPointerIcon (Landroid/view/PointerIcon;)V
2022-10-20 11:37:13.410  2611-2611  dalvikvm                com.windowsgames.firefight           I  Could not find method org.libsdl.app.SDLSurface.setPointerIcon, referenced from method org.libsdl.app.SDLActivity.setSystemCursor
2022-10-20 11:37:13.410  2611-2611  dalvikvm                com.windowsgames.firefight           W  VFY: unable to resolve virtual method 811: Lorg/libsdl/app/SDLSurface;.setPointerIcon (Landroid/view/PointerIcon;)V
2022-10-20 11:37:13.430  2611-2611  dalvikvm                com.windowsgames.firefight           I  Could not find method android.content.res.Configuration.getLocales, referenced from method org.libsdl.app.SDLActivity.onCreate
2022-10-20 11:37:13.430  2611-2611  dalvikvm                com.windowsgames.firefight           W  VFY: unable to resolve virtual method 98: Landroid/content/res/Configuration;.getLocales ()Landroid/os/LocaleList;
2022-10-20 11:37:13.560  2611-2611  dalvikvm                com.windowsgames.firefight           I  Could not find method android.media.AudioTrack.write, referenced from method org.libsdl.app.SDLAudioManager.audioWriteFloatBuffer
2022-10-20 11:37:13.560  2611-2611  dalvikvm                com.windowsgames.firefight           W  VFY: unable to resolve virtual method 157: Landroid/media/AudioTrack;.write ([FIII)I
2022-10-20 11:37:13.560  2611-2611  dalvikvm                com.windowsgames.firefight           I  Could not find method android.media.AudioRecord.read, referenced from method org.libsdl.app.SDLAudioManager.captureReadByteBuffer
2022-10-20 11:37:13.560  2611-2611  dalvikvm                com.windowsgames.firefight           W  VFY: unable to resolve virtual method 140: Landroid/media/AudioRecord;.read ([BIII)I
2022-10-20 11:37:13.560  2611-2611  dalvikvm                com.windowsgames.firefight           I  Could not find method android.media.AudioRecord.read, referenced from method org.libsdl.app.SDLAudioManager.captureReadFloatBuffer
2022-10-20 11:37:13.560  2611-2611  dalvikvm                com.windowsgames.firefight           W  VFY: unable to resolve virtual method 141: Landroid/media/AudioRecord;.read ([FIII)I
2022-10-20 11:37:13.560  2611-2611  dalvikvm                com.windowsgames.firefight           I  Could not find method android.media.AudioRecord.read, referenced from method org.libsdl.app.SDLAudioManager.captureReadShortBuffer
2022-10-20 11:37:13.560  2611-2611  dalvikvm                com.windowsgames.firefight           W  VFY: unable to resolve virtual method 143: Landroid/media/AudioRecord;.read ([SIII)I
2022-10-20 11:37:13.570  2611-2611  dalvikvm                com.windowsgames.firefight           I  Could not find method org.libsdl.app.SDLActivity.isInMultiWindowMode, referenced from method org.libsdl.app.SDLSurface.surfaceChanged
2022-10-20 11:37:13.570  2611-2611  dalvikvm                com.windowsgames.firefight           W  VFY: unable to resolve virtual method 615: Lorg/libsdl/app/SDLActivity;.isInMultiWindowMode ()Z
2022-10-20 11:37:13.750  2611-2611  linker                  com.windowsgames.firefight           W  library "libmaliinstr.so" not found
2022-10-20 11:37:13.750  2611-2611  linker                  com.windowsgames.firefight           W  error:
2022-10-20 11:37:13.830  2611-2659  libOpenSLES             com.windowsgames.firefight           W  class OutputMix interface 0 requested but unavailable MPH=43
2022-10-20 11:37:13.870  2611-2659  SDL/APP                 com.windowsgames.firefight           I  pixel format wanted SDL_PIXELFORMAT_RGBA8888 (1), got SDL_PIXELFORMAT_RGBA8888 (1)

those are error / warning message. but on older android this is expected. SDL checks for api version before calling all the missing API.
for instance isInMultiWindowMode is API 24, it won’t be called because you’re on API 19
btw.
what are your minSdkTarget ? APP_PLATFORM ? targetSdk ? compileSdkVersion ?

But after : pixel format wanted SDL_PIXELFORMAT_RGBA8888

you should have much more… didn’t you say that you app was reacting (like sound is playing for instance). so this is only a black screen appearing ?

… could this be an issue with audio ? (libOpenSLES)
src/audio/SDL_audio.c : comment out: &openslES_bootstrap

My build.gradle:

apply plugin: 'com.android.application'
android {
    compileSdkVersion 31

    defaultConfig {
        applicationId "com.windowsgames.firefight"
        minSdkVersion 19
        targetSdkVersion 31
        ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    externalNativeBuild {
        ndkBuild {
            path 'src/main/jni/Android.mk'
        }
    }
}

dependencies {
}

AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<!-- Replace org.libsdl.app with the identifier of your game below, e.g.
     com.gamemaker.game
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.windowsgames.firefight"
      android:versionCode="5100"
      android:versionName="5.1.0"
      android:installLocation="auto">

    <!-- Android 2.3.3 -->
    <!--
    <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="12" />
    -->

    <!-- OpenGL ES 2.0 -->
    <uses-feature android:glEsVersion="0x00020000" />

    <!-- Allow writing to external storage -->
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <!-- Allow access to the vibrator -->
    <!-- <uses-permission android:name="android.permission.VIBRATE" /> -->

    <uses-feature android:name="android.hardware.audio.low_latency" android:required="false" />
    <uses-feature android:name="android.hardware.audio.pro" android:required="false" />

    <!-- if you want to capture audio, uncomment this. -->
    <!-- <uses-permission android:name="android.permission.RECORD_AUDIO" /> -->

    <!-- Create a Java class extending SDLActivity and place it in a
         directory under src matching the package, e.g.
         	src/com/gamemaker/game/MyGame.java

         then replace "SDLActivity" with the name of your class (e.g. "MyGame")
         in the XML below.

         An example Java class can be found in README-android.md
    -->
    <application android:label="@string/app_name"
                 android:icon="@drawable/firefight"
                 android:allowBackup="true"
                 android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
                 android:hardwareAccelerated="true" >
        <activity android:name="MyGame"
                  android:label="@string/app_name"
                  android:exported="true"
                  android:screenOrientation="portrait"
                  android:configChanges="keyboardHidden|orientation|screenSize"
                  >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <!-- Drop file event -->
            <!--
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="*/*" />
            </intent-filter>
            -->
        </activity>
    </application>

</manifest> 

Application.mk:


# Uncomment this if you're using STL in your project
# See CPLUSPLUS-SUPPORT.html in the NDK documentation for more information
#APP_STL := stlport_static

APP_CFLAGS += -DPNG_ARM_NEON_OPT=0

APP_ABI := armeabi armeabi-v7a x86

# Min SDK level
APP_PLATFORM=android-10

# Enable c++11 extentions in source code
APP_CPPFLAGS += -std=c++11

Android.mk:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := main

LOCAL_CPPFLAGS += "-DNDEBUG"

SDL_PATH := ../SDL2

LOCAL_C_INCLUDES := $(LOCAL_PATH)/$(SDL_PATH)/include $(LOCAL_PATH)/../SDL2_image/ $(LOCAL_PATH)/../SDL2_ttf/ $(LOCAL_PATH)/../SDL2_mixer/

# Add your application source files here...
PROJECT_FILES := $(wildcard $(LOCAL_PATH)/*.cpp)
PROJECT_FILES += $(wildcard $(LOCAL_PATH)/../../../../../../../../CrossPlatform/SharedCode/Serialize/*.cpp)
PROJECT_FILES += $(wildcard $(LOCAL_PATH)/../../../../../../../../CrossPlatform/SharedCode/UX/*.cpp)
PROJECT_FILES += $(wildcard $(LOCAL_PATH)/../../../../../../../../CrossPlatform/Firefight/*.cpp)

LOCAL_SRC_FILES := $(PROJECT_FILES)

LOCAL_SHARED_LIBRARIES := SDL2 SDL2_image SDL2_ttf SDL2_mixer

LOCAL_LDLIBS := -lGLESv1_CM -lGLESv2 -llog

include $(BUILD_SHARED_LIBRARY)