x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Android API 23 XAPK validation failed due to OBB permissions

Hi,

Android 6 devices are getting XAPK validation failed on start up while validating the game OBB as it requires Storage permission to read it. When the device gets restarted the game opens normally without the need of any permissions this is due to the fact that it puts the obb under root user before restart and adjusts the user after restart. There is a bug currently opened on Android for this https://issuetracker.google.com/issues/37544273

I have published my game with Target API 23 and Google Play Console does not allow to lower it so I am stuck with it now but can't market the game due to this issue. Is there any workaround for this ?

Product Version: UE 4.16
Tags:
more ▼

asked Aug 03 '17 at 10:07 AM in Packaging & Deployment

avatar image

hossam.ahamid
6 2 5 4

avatar image hossam.ahamid Aug 04 '17 at 07:58 PM

Any help for this ?

avatar image FollowMyStaR Feb 12 '19 at 09:37 AM

Can you please update to downloanderactivity ue 4.21? thanks.

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

So sorry for the late response, here is what I have done..

I have edited DownloaderActivity.java.template which is mostly located in C:\Program Files\Epic Games\UE_4.16\Engine\Build\Android\Java\JavaTemplates

  • Created a new Java method called doOnCreate()

  • Took all the contents of onCreate method, pasted them into doOnCreate() and called it from onCreate

  • In method doOnCreate() I have added the following code on top to request for Write permission if it was not already granted

           if (android.support.v4.content.ContextCompat.checkSelfPermission(_download,
                     android.Manifest.permission.WRITE_EXTERNAL_STORAGE)
             != android.content.pm.PackageManager.PERMISSION_GRANTED) {
                     
                     android.support.v4.app.ActivityCompat.requestPermissions(_download,
                     new String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE},
                     MY_PERMISSIONS_REQUEST_STORAGE_ACCESS);
                 
             }
    
    
  • MY_PERMISSIONS_REQUEST_STORAGE_ACCESS is an integer constant that you need to declare first and assign an integer value to it.

  • Created another override method to check the outcome provided by user for the permission request whether it is granted or not. if granted, calls doOnCreate() method again.

            @Override
             public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
                 
                 switch (requestCode) {
                     case MY_PERMISSIONS_REQUEST_STORAGE_ACCESS: {
                         // If request is cancelled, the result arrays are empty.
                         if (grantResults.length > 0
                             && grantResults[0] == android.content.pm.PackageManager.PERMISSION_GRANTED) {
         
                             doOnCreate();
         
                         } else {
         
                             this.finish();
                         }
                         return;
                     }
                 }        
             }
    
    
    
  • That's it, I hope this helps. This is the basic implementation, you can handle the rejection as you see fit. These information for granting storage access can be referred to in Android documentation for API 23+. Full Java file is also attached (UE V4.16) link text .

more ▼

answered Oct 04 '17 at 11:30 PM

avatar image

hossam.ahamid
6 2 5 4

avatar image iscaru1988 Nov 06 '17 at 11:54 AM

Oh thanks for this piece of wisdom!!!, Ill give it a try.

avatar image Rin-chan Mar 26 '18 at 01:00 PM

I tried this and got "cannot find symbol" error during packaging referring to MY_PERMISSIONS_REQUEST_STORAGE_ACCESS does anyone know a solution for this?

avatar image LCDLV Jul 31 '18 at 07:56 PM

Do you have an update for version 4.20? I'm having this issue and I try this solution, but I have errors on compiling.

(comments are locked)
10|2000 characters needed characters left

I have edited DownloaderActivity.java.template to request for Storage access permission request at first if not granted as temp solution.. is there any workarounds else to fix this problem without requesting "dangerous permissions" ?

Thanks.

more ▼

answered Aug 08 '17 at 09:16 PM

avatar image

hossam.ahamid
6 2 5 4

avatar image iscaru1988 Sep 19 '17 at 10:21 AM

Hi I'm having the same trouble, but I have never programmed in java. Would you please tell me what change did you made to fix this issue. Thanks a lot!

avatar image TheNebelung Sep 21 '17 at 08:08 AM

I am also curious what changes you made for this.

avatar image hossam.ahamid Sep 21 '17 at 11:35 AM

I am traveling away right now, I will post this solution changes tomorrow when I get back

avatar image iscaru1988 Sep 21 '17 at 11:39 AM

THANK YOU SO MUCH! :)

avatar image TheNebelung Sep 24 '17 at 02:54 PM

Thank you for helping. I look forward to the fix as well

avatar image hossam.ahamid Oct 04 '17 at 11:31 PM

Please refer to my answer below.

avatar image Awicks Aug 30 '18 at 09:14 PM

Hey Hossam. I was hoping you could provide additional clarification for me in regards to you your code. I'm implemented it in my project. When I download the app the first time, my splash screen shows, and then the permission dialog shows. I answer "yes" to the permissions. However, since the splash screen is already displayed and I still receive the XAPK File Validation error. Any ideas or further instruction you can provide me with? Would really appreciate it!

Thanks

avatar image aamir hussain Jan 28 '19 at 07:02 AM

Can you tell me how to fix this issue for 4.21

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question