Xapk validation failed google play

Hi
After first download from google play i getting xapk validation failed.
My apk is 25m.
Please help
10x

I was able to find a previous post about this issue, but I’m not sure how much help it will be: Published Android game - XAPK File Validation failed - Android Development - Unreal Engine Forums

there is no temp fix?
most people with newer phones has this issue.
i tried adding android.permission.WRITE_EXTERNAL_STORAGE on project settings->extrapermissions array and checking UseexternalFilesDir with no success

Besides that savegames are not saved on devices with android 23up

It’s still not investigated when it occurs… :frowning: We know that for sure it’s not related to Android Version and Device Model… It’s not possible to make hotfix when reason is unknown.

I think the fix has to come from epic.

Right now, the obb is saving in the root folder.
When the game first loads up, it looks for the obb but does not have the permission to find it.
Unreal doesn’t ask for the permission and then you get the XAPK validation error.

One user has said he changed up his Downloader.Activity.java file to request the access when temp access isn’t granted.
“I have edited DownloaderActivity.java.template to request for Storage access permission request at first if not granted as temp solution…”
He didn’t share exactly what he did though.

Here is the google link of the issue for people who use other platforms to develop games. Google has known about the issue for years but what people in the thread complain about is being forced to USE a dangerous permission to make the error go away. Currently in UE4, even WITH the write external permission activated, the XAPK error still happens.

Android permissions cant be requested at run time from inside the game because the game is never properly installed enough to get to that point.

Common Denominators
-Game over 100 mbs with an OBB file.
-Fresh installs only (updates of the game work fine)
-Targeting SDK 23 or above

Another issue is the UE4 game files saving out in the open including the save files. Don’t know if that has any affect on the above.

For anyone that is running into this, the user has 3 options at the moment.

  1. The one that works 100% of the time is simply restarting the device. The obb is placed correctly for some reason and the game installs properly when loading the app.
  2. The second thing is going to settings>applications>(App name)>permissions>storage and turning it on. When you load up the game, the app will properly install.
  3. The 3rd is something that doesn’t work 100% of the time, but when the app loads up and you see the xapk, sometimes you can press the android back button and it will ask for the storage permission. After saying yes, the app will background itself and take you to the home screen. If you go straight back to the app, it will crash. If you force close the app and reopen it, it will work properly.

Hope this helps.

You can try making this modification to GameActivty.java.


PermissionHelper.acquirePermissions(new String] {"android.permission.WRITE_EXTERNAL_STORAGE"}, this);

This is only called for non-shipping builds right now. Try moving it out of the else so it is always called. This will make it request permission even if it doesn’t need to download, though.

If you only want it to do this if it has to download the OBB you can put it in Build/Android/Java/JavaTemplates/DownloaderActivity.java.template in onCreate() after the


GameActivity.Log.debug("... Whoops... missing; go go go download system!");

maybe. I’m going to have to do some more looking into this.

Also add


import com.google.vr.sdk.samples.permission.PermissionHelper;

with the other imports.

Hey Chris,

I gave both solutions a try but neither did the trick.
I did try both at the same time as well but XAPK still shows.
I uploaded the apk and OBB to the store for all 3 builds.

The OBB gets downloaded from the store into root>sdcard>Android>obb if that helps at all.

I do appreciate you trying to help me out. If you have any other suggestions, let me know.

(Meant to edit the post above. Sorry)
edit:
So i ended up moving


PermissionHelper.acquirePermissions(new String] {"android.permission.WRITE_EXTERNAL_STORAGE"}, this);

to the “Else” (Check 'em Dano…lol) part of that statement because the OBB was downloaded correctly. When i open the game now, it does ask for storage permissions immediately which is cool.
The problem is that even after accepting, it just sits there.
Is there a way to call the install process of the OBB once accepted.

I am thinking it might be this code


ProcessOBBFiles();

Found slightly below.
I think it is trying to run that code before I even accept the storage permissions so even after i accept, it doesn’t try again basically.
Any advice on this?

I think it might need some restructuring to do checks if already granted and to deal with onRequestPermissionResult to resume; this looks a little messier of a fix.

Any resolution on this? I have been trying to get a distribution build to work after downloading from the Play Store with 4.18.2 but always get the xapk validation failed error.

did you check user externalfilesdir in project settings/Android?

I think thats partially working. The download screen still shows up and says xapk validation failed but it seemed to run afterwards after freezing for awhile. I will test some more later today. It seems somewhat broken still considering the .APK and the .OBB files are downloaded when you install off google play and the obb is not downloaded separately on the first run.

Anyone here who know how to fix this problem

Still waiting for the this ?

Good day. Yes get this problem today. Full APK is workig fine, but with OBB its crash. What can i do with this problem? Thank you

I tried all the suggestions I could find.

Still getting XAPK Validation Failed.

I simply don’t know what else to do. I’m hopeless about getting my app on google play.