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 - Path to Content Dir from Java code

I'm adding some Java files to my Android project and using UPL to add them into the build.
I've also got some files in the content directory that I need to reference from the Java code. Those files are set as "Non-asset files to copy" in the project's packaging settings.
How can I find these files during runtime on the android device?

Using the relative path from GetProjectContentDir does not seem to work. Looking around some of the engine's java code, I've tried plugging in a bunch of different variables and paths, but none seem to point to the right place (InternalFilesDir, ExternalFilesDir, Context.GetDataDir(), Context.GetFilesDir(), many others).

Poking around in the apk, I've found the files inside main.obb.png, in ProjectName/Content/.

Product Version: UE 4.21
Tags:
more ▼

asked Apr 03 '19 at 04:52 PM in Using UE4

avatar image

cabrown242
26 1 1

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

1 answer: sort voted first

In case anyone else has this problem in the future, the fundamental problem I was running into was assuming that the files I was looking for would exist in the filesystem on the android device. The Unreal File System tools do some obfuscation, and the files don't actually exist on the file system in same manner as they would on PC/Mac.

Because my Java library needs to read a file off the filesystem this is problematic. So to solve this, in my project's c++ code I'm reading these files using the UE4 tools, and then writing them to location on the file system.

more ▼

answered Apr 04 '19 at 04:40 PM

avatar image

cabrown242
26 1 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