Ever since I’ve moved to SDL 2.30 to meet SDK34 requirements. Android crash’s have skyrocketed with certain android devices, keeps pointing to a c++ function that I see nothing wrong with. I’m using the same NDK also. The Android devices I have at home all work, but other’s users the logs state a crash that keeps repeating.
If you are asking for help, then let’s get a bit more information;
- Please show us the function that is getting the blame.
- Please copy and paste those error logs (I’m assuming they do not contain client’s personal info).
- Is there some action you might be able to link to the crash such as switching from landscape to portrait mode, or reading/writing a file?
3.a Some permission requirements may have changed since you recently upgraded to SDK34, so double check app permissions in your code, also be wary of any deprecated API calls that may have been phased out. - Are the devices that are crashing also SDK34, or is there a commonality of SDK level for the crashing devices?
- Create a new minimal project that reproduces the errors and post the code here for us to test, that could be very helpful.
It sounds like you might not own a device that is crashing, but rather have customers with devices that are crashing. My concern is that the SDK34 might have an incompatibility with older versions, and you may have to raise your lowest SDK limit for your app. On the other hand, if it is the newest devices with a crash, then see 3.a above.
@Timodor, what do the Google Console crash reports look like?
Crashes have almost flat-lined for me, especially since the latest source.
Here are the greatest crash offenders for me:
SDL_EGL_SwapBuffers
android.content.res.Resources.getText
android.content.res.HwResources.getText
utext_close_63
How do the ANRs look also?
void sv_Ball::Gravity()
{
if(sv_Clock0 == nullptr)
{
GravityFix();
}float delta = sv_Clock0->GetDelta(); if (fYpos > 2.2f) { fYpos = fYpos - ( fSpeedFall * delta ) ; //if (fSpeed > 200 ) //fSpeedFall = fSpeedFall + (98.1 * sv_Clock0->GetDelta() ); // 0.01 // 80 // else fSpeedFall = fSpeedFall + (98.1f * delta ); // 0.01 // 36 //FIX?? if(fSpeedFall > 500 || fSpeedFall < 0) { fSpeedFall = 0; } //FIX?? // if(fYpos > 500 || fSpeedFall < -10) { fYpos = 0; } } else { fSpeedFall = 0; fYpos = 2.2f; }
}
It seems to getting into the game, since their crashing at a server level function mostly. Maybe it’s some type of memory leak. Mostly Androids 10’s, then 11’s then 14’s. It’s not older devices.
Which version you using?
I’m going to place a bet that you’re having issues with an invalid pointer in sv_Ball::Gravity(), and this is only exposed because of allocated memory being zero-initialized in certain Android versions.
I’ve been updating my apps with a lot of different versions of SDL during its development over the years and have never seen that level of crashing, so it’s 100% something in your code.
It’s still crashing, I added the pointer check yesterday. Maybe it’s corrupted. It only starting happening with version SDL 2.30