[4.6] Unproper adding Android java libraries?

  • Engine - 4.6 release
  • NDK - r9c
  • ANT - 1.8.2
  • Windows 7 64bit / Visual Studio 2013 Express

Hi.

I’m currently working on Facebook implementation for Android and I think I found a bug in UEDeployAndroid.

To add the Facebook SDK I put their catalog (with manifest, build.xml, src etc.) into Engine/Build/Android/Java/JavaLibs. But when I build the engine (Development Android) it looks like the UBT can’t see it.

I dig around and found out that the UBT is running update project using command:

C:\NVPACK\android-sdk-windows/tools/android.bat --silent update project --subprojects --name UE4Game --path . --target android-19 --library JavaLibs/facebook-android-sdk_rev3211 --library JavaLibs/google-play-services_lib_rev19

The problem is that this command generates project.properties with line:

android.library.reference.1=JavaLibs/google-play-services_lib_rev19

So it didn’t add the library. I found out that for proper work the command need to be run twice with both of libraries, so:

C:\NVPACK\android-sdk-windows/tools/android.bat --silent update project --subprojects --name UE4Game --path . --target android-19 --library JavaLibs/facebook-android-sdk_rev3211
C:\NVPACK\android-sdk-windows/tools/android.bat --silent update project --subprojects --name UE4Game --path . --target android-19 --library JavaLibs/google-play-services_lib_rev19

After that the project.properties looks fine:

android.library.reference.1=JavaLibs/facebook-android-sdk_rev3211
android.library.reference.2=JavaLibs/google-play-services_lib_rev19

And the project has built properly.

I made a quick fix in UEDeployAndroid.cs at the end of UpdateProjectProperties function I changed the loop so it runs multiple update projects with single libraries in the argument.

I’m not sure if You want to solve it like that but it would be great to look at this problem.

Oddly, I thought we had fixed it, but I see it wasn’t, so thank you for this report!

I changed it like this:

			foreach (string Lib in LibsToBeAdded)
			{
				string LocalUpdateCommandLine = UpdateCommandLine + " --library " + Lib;

				// make sure each library has a build.xml - --subprojects doesn't create build.xml files, but it will create project.properties
				// and later code needs each lib to have a build.xml
				if (!File.Exists(Path.Combine(Lib, "build.xml")))
				{
					RunCommandLineProgramAndThrowOnError(UE4BuildPath, AndroidCommandPath, "--silent update lib-project --path " + Lib + " --target " + GetSdkApiLevel(), "");
				}
				RunCommandLineProgramAndThrowOnError(UE4BuildPath, AndroidCommandPath, LocalUpdateCommandLine, "Updating project.properties, local.properties, and build.xml...");
			}

Does that look about right for what you did?

Josh

More or less, but it does the same. I’ll use Your code for now so there won’t be any conflicts in the future :wink: