How to get Android Logs with Scoped Storage?

I am having some trouble figuring out how to debug my game on Android now.

Since the Android 12+ scoped storage requirements, Unreal cannot get the permission to save files to the device unless it is set to Shipping Mode with For Distribution checked.

In Shipping Mode, there are no logs. I have tried enabling logs with the Target.cs trick and it does not work either.

There seems to be no way to get a log on Android anymore.

Logcat does not work either, in shipping mode, there is no logs from Unreal.
I tried the Unreal Plugin Language .upl scoped storage fix, doesn’t work.

I have resorted to a UI and manually printing strings to it which is treacherous.

I’ve been searching online, very surprised this hasn’t come up yet…?

Is there a workaround?

Major Bump! No way to access logs in Distribution Builds so far on Android

1 Like

Alright, this is not what we want to see, but it will do for now.

Thank you to lion from Multiplayscape with providing me with a solution.

You do need to use a source build, I already am so it’s not too bad, but definitely will be a bummer for those on binary. Also you will need to rebuild the engine which takes time.

In the file: UnrealEngine\Engine\Source\Runtime\Core\Private\Android\AndroidPlatformMisc.cpp

Comment out lines 290 and 321. (Add // before the line.)

Make sure to make a backup and restore this before you release your app as you don’t want logs in your final build. Also since you’re modifying the engine, this will effect every project you use with this source build.

Then rebuild the engine. Takes some time. Rebuild your project and make a new Shipping/For Distribution build.

Now immediately, this does not produce a .txt log file still, but you can access the logs using logcat.

Open command prompt and type adb devices to get your device ID.

Then use the command:
adb -s REPLACE_WITH_DEVICE_ID logcat -s AndroidRuntime -s UE

You will see the equivalent of a log in realtime.

Kind of a dirty fix, but it works for now. Given new Android requirements, I hope an easier remedy becomes available in the future.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.