Android builds won't run on API 19 or below. Always Crashes! API 24 Gives XAPK VALIDATION ERROR | 4.16.2

Since Unreal Engine 4.16 (and it’s variants 4.16.1 / 4.16.2) came out, I updated all my projects from 4.15 to this new version and it only gave me problems!

I was expecting in this new engine version to get best android performance, among other things (since my focus is mobile/android development), instead, I had to unsupport all android devices from API 19 and below since every time I package my projects to this devices it always crashes no matter what I do. Every Project I Build for API 21 and up works with no problems, BUT, some problems return on API 24 (Nougat).

Since I began developing on Unreal Engine last year, I’ve been learning many things from this awesome engine. My very first Project was done on Unreal 4.10 and it worked great on API 14 and up devices. Since that time, I’ve been trying to better optimize that Project with the new UE4 versions that came out and right now we are at 4.16.2 and I have 4 developed games released to the store and with some more currently in development.

All my 4 projects currently released, before 4.16, they worked on all devices from API 14 and up. Now with 4.16 I tried a different packaging method - creating multiple APK in order to better optimize my games for all kinds of devices.


Steps I’m taking:

1 - Made an APK to support API 15 minimum and target 19 to use ETC1 textures. (NDK 19 and SDK = matchndk)

2 - Made an APK to support API 21 minimum and target 23 to use ETC2 textures and ES2 and ES3.1 (NDK 21 and SDK 23)

3 - Made an APK to support API 24 minimum and target 24 to use ETC2 textures, ES2 and ES3.1 and VULKAN (NDK = latest and SDK = latest)

4 - Uploading to Google Developer Console the 3 different APK at the same time and their respective OBB files.


Problems:

  • Problem 1 - The APK based on 15/19 does not work and crashes on it’s respective devices.

  • Problem 2 - The APK based on 24/24 launches but the user can’t play because it always says XAPK VALIDATION FAILED so this version of the game is stuck at the splash screen and I already verified from my tests that the OBB was correctly downloaded!

PS: Only the APK 21/23 is working Correctly with no problems at all!


If Epic Games’ STAFF tries to help me with this, please have a Nougat Device at hand, a Lollipop/Marshmallow Device at Hand AND a Kitkat/or below Device at hand. This way you can reproduce my problems.

The apps to test are the following (you can test the first one only as the errors are all the same for all apps):

App 1 - https://play.google.com/store/apps/details?id=com.PlatinumBladeGames.UnrealSystemBenchmark

App 2 - https://play.google.com/store/apps/details?id=com.lightrunnerthegame.lightrunner

App 3 - https://play.google.com/store/apps/details?id=com.PlatinumBladeGames.EpicAdventureArcadeShooter


Since I couldn’t make API 19 or below to run, the current version from my apps are 21 and up so I’m attaching a test app so you can reproduce the Problem 1 with an API 19 Device

https://drive.google.com/open?id=0B0R_H2CH_HxpdVVqVFhDRDZDUXM

Below are screenshots for my API 19 builds:

I’m also attaching the logcat here:
[link text][3]


I really hope you can help me with this. Thanks!

The answer given here by JackP - 4.16.1 Dev build app crashes on start "unfortunately [App] has stopped" on android - Mobile - Unreal Engine Forums -
seems to solve the problem I’m having with API 19 or below. It is recognized as issue UE-46539.

So now the only problem that remains is the XAPK Validation Fail. Please Epic Games Staff members, try to investigate this problem further.

Thanks for the answers until now. Have a great day all!

Yes, the issue with below Android 19 was due to dependency on runtime libc functions which are missing on older Android devices and has been fixed.

The settings you should use are NDK API level “android-19” and SDK API level “latest”. There is no reason to change these; ARM64 will automatically use NDK android-21 if needed (you will see this in the log). The NDK external libraries are compiled with needs to match with the engine compile so it is not recommended to change these yourself unless you have a specific reason to do so. The SDK API level needed to be set lower before we fixed depreciated API calls in the download library code but it should be fine now.

Minimum SDK controls the required minimum level to install the APK. Target SDK controls the expected level of API support and fallback behavior. Setting this to 23 requires runtime permissions to be properly implemented; setting it lower does not require it. I’m not sure why 24 would break it unless there was another security change to accessing the OBB download location which is causing the verify to fail. If you need to force it to work only on 24 you could try setting minimum to 24 and target to 23 and see if that works; it should still be filtered out from installing on <24 but use the behavior of 23 for permissions/security.

ES3.1 and Vulkan work regardless of the NDK setting; we directly hook to the vulkan loader if available on device and check for a valid driver if the support was enabled for the APK. API 24 is not required for Vulkan (Samsung shipped Vulkan on 6.0).

The reason why I’m doing this is because of feature levels.

I’m uploading multiple apks to my the Developer Console because I’m using ES2 + ETC1 for API 19/Below using NDK 19.

ES2 + ES3.1 + ETC2 for API 21 ~ 23 using NDK 21 in order to support ES3.1.

ES2 + ES3.1 + VULKAN + ETC2 for API 24 using NDK 24 (latest) in order to support Vulkan on nougat devices.

Correct me if I’m wrong but, everytime I tried to make an APK with support for 3.1 and Vulkan using NDK 19, the packaging always failed so this was the solution I found in order to support everything and make my games more compatible with more devices. But everytime someone with a nougat device installs my game from the store it always returns the XAPK error.