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"

UE4Game folder on External Storage - Android

Hello UE Team, I wanted to know whether it's possible to prevent a ue4 android game to create a folder (UE4Game and its content) automatically in External storage? I want to have it on internal data folder (like android/data/com../UE4Game/) so the user can't see the save games easily (e.g)

Product Version: UE 4.13 Preview
more ▼

asked Aug 28 '16 at 01:21 AM in Using UE4

avatar image

Ahmet Zambak
41 1 4 7

avatar image wingedrobin Sep 14 '16 at 04:59 AM

Same question. Another pain is that when app was uninstalled, the UE4Game folder will not be auto removed. I think that is a bad user experience. Why design this like that? Is there any pros or limitation?

I found a global variable GFilePathBase at line 865 in file \Engine\Source\Runtime\Launch\Private\Android\AndroidJNI.cpp. It is assigned to ExternalStorageDirectory(/storage/sdcard0) of Android. And another global variable GExternalFilePath at line 926 is assigned to ExternalFilesDir(/storage/sdcard0/Android/data/package/files), I think this is what we looking for. But now I don't have any idea to modify it to suit this purpose. Maybe someone else has any idea or experience?

avatar image Ahmet Zambak Sep 16 '16 at 10:35 PM

I edited those variables. Now I'm trying to build the engine. Hoping for no errors :)

avatar image Ahmet Zambak Sep 19 '16 at 09:11 PM

Unsuccesful with building engine from source code for android

avatar image darren_mii Oct 10 '16 at 02:13 PM

Can someone from Epic please answer this

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Any files placed in GExternalFilePath will be cleaned up when the APK is uninstalled. You can make this change in AndroidJNI.cpp to ue4_GameActivity_nativeSetGlobalActivity after GExternalFilePath = FString(nativeExternalFilesPathString):

 GFilePathBase = GExternalFilePath;

This will use the external file path for shipping builds. You don't want to do this for launch-on since it expects to find the pushed files in the normal location.

I am planning to provide this as a checkbox option in 4.15; the feature set for 4.14 is already locked down.

more ▼

answered Oct 19 '16 at 05:16 PM

avatar image

Chris Babcock STAFF
1k 11 110 35

avatar image mikechan Oct 20 '16 at 06:31 AM

After I did that, an error message showed up when I launched project on Android device.alt text

How can I fix this?


avatar image Chris Babcock STAFF Nov 09 '16 at 11:31 PM

I believe you have an OBB outside of the APK and it is failing to mount it. There is a fix, but it involves a few more changes.

In AndroidFile.cpp:

add FString GFileExternalStorage; before

 // External File Path base - setup during load
 FString GFilePathBase;

Then change

 FString OBBDir1 = GFilePathBase + FString(TEXT("/Android/obb/") + GPackageName);
 FString OBBDir2 = GFilePathBase + FString(TEXT("/obb/") + GPackageName);


     FString OBBDir1 = GFileExternalStorage + FString(TEXT("/Android/obb/") + GPackageName);
     FString OBBDir2 = GFileExternalStorage + FString(TEXT("/obb/") + GPackageName);

In AndroidJNI.cpp:

add extern FString GFileExternalStorage; before extern FString GFilePathBase;

add '`GFileExternalStorage = GFilePathBase;` after GFilePathBase = FString(nativePathString); in JNI_OnLoad().

Now it will still be able to access the OBB.

avatar image mikechan Nov 10 '16 at 04:22 AM

It works! Thank you!

avatar image wingedrobin Nov 10 '16 at 05:02 AM

Hi Chris, thanks for the solution. And I wanna confirm one thing that is this will certainly add into UE4 in version 4.15?

avatar image Chris Babcock STAFF Nov 15 '16 at 05:39 PM

Yes, it is a checkbox in 4.15.

avatar image BPSailor Mar 15 '17 at 09:08 AM

Hi Chris, thanks for the solution. But how to compile after modify the AndroidFile.cpp ? Is open the UE4.sln to do compile?

avatar image wingedrobin Mar 15 '17 at 09:38 AM

Of course, that is one of the file in engine sources.

avatar image BPSailor Mar 16 '17 at 01:51 AM

Thanks a lot, wingedrobin :D

avatar image wingedrobin Nov 27 '17 at 09:13 AM

Hi, Chris. Is this the checkbox that you said? alt text If yes, is the functionality implemented yet? No matter i check or uncheck the Use ExternalFilesDir for UE4Game files, the UE4Game folder is always be created outside of the Android/data/ folder.

There will create UE4Game and obb two folder under /storage/sdcard0, and create a game project folder under /storage/sdcard0/Android/data but only contain ca-bundle.pem and login-identifier.txt two files. All files of project are still placed in /storage/sdcard0/UE4Game, not in /storage/sdcard0/Android/data.

And the Install Location option on the picture seems no use either. So is the only way that I want to place my whole game content into /storage/sdcard0/Android/data folder is to modify the source code of the engine??

PS: I tried in development build and shipping build are the same result.

avatar image Ahmet Zambak Oct 20 '16 at 02:26 PM

Ok, better I wait until version 4.15. I'm unsure while editing the source code, so I let the Epic developers do that.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

There are serious problems. If user doesn't have external sdcard, UE4Game folder is created in Internal storeage and It will not be removed when uninstall. And another problem is that All game resource images are shown in gallery app.

I hope these Problems will be fixed in 4.15

more ▼

answered Dec 02 '16 at 05:05 AM

avatar image

11 1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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