Android Package Name Containing "build" fails to copy generated JAVA files

Hello!

We recently changed android package name from

com.netspeakgames.hamlet

to

com.netspeakgames.townbuilder

And our Android builds started failing, complaining about not being able to find symbols for OBBDownloaderService or DownloadShim

UATHelper: Packaging (Android (ETC2)): Z:\app\src\main\java\com\epicgames\unreal\DownloadShim.java:3: error: cannot find symbol UATHelper: Packaging (Android (ETC2)): import com.netspeakgames.townbuilder.OBBDownloaderService;

Looking into the intermediate directories, I could confirm that the generated Java files in

\Build\Android\src\com\netspeakgames\townbuilder were present and correct (and had the right package names generated)

They were happily copied to

\Intermediate\Android\arm64\gradle\app\src\main\java\com\netspeakgames\townbuilder

Correctly, but failed to be copied to:

Intermediate\Android\gradle\app\src\main\java\com\netspeakgames

The offending code, it turns out (after a few days of fun logging) was in

UEDeployAndroid.cs in the build tool:

// skip the build directories

string Workname = Filename.Replace(“\\”, “/”);

string DirectoryName = Path.GetDirectoryName(Filename)!.Substring(UnrealBuildGradlePathLength);

if (DirectoryName.Contains(“build”) || Workname.Contains(“/.”))

… continue;

I’ve changed this to:

string folders = DirectoryName.Split(Path.DirectorySeparatorChar, StringSplitOptions.RemoveEmptyEntries);

if (folders.Any(f => f.Equals(“build”, StringComparison.OrdinalIgnoreCase)) || Workname.Contains(“/.”))

And the build is now fine. If you have any thoughts or comments on a better approach, I’d appreciate it (I also appreciate I could have just called the package something else…but after several days it felt like a weak victory!)

Steps to Reproduce
Package an android game with the android package name containing the word “build”

ie:

com.mycompany.buildersgame

com.mybuildinggames.gametwo

Hi Callum,

Thank you for bringing this to our attention. Your fix would resolve the issue. We’ve implemented it in a slightly stricter fashion here. https://github.com/EpicGames/UnrealEngine/commit/e42c205e1f5dfd25db9ed14ce0b166c4ddc15c66

Best regards.

Wonderful, will push into our fork. Thanks for the quick response team!