diff --git a/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs b/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs index 9332d08ed42..ea29896fca5 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs @@ -216,6 +216,8 @@ namespace GodotTools.Export bool embedBuildResults = ((bool)GetOption("dotnet/embed_build_outputs") || platform == OS.Platforms.Android) && platform != OS.Platforms.MacOS; + var exportedJars = new HashSet(); + foreach (PublishConfig config in targets) { string ridOS = config.RidOS; @@ -325,14 +327,6 @@ namespace GodotTools.Export { string fileName = Path.GetFileName(path); - if (fileName.EndsWith(".jar")) - { - // We exclude jar files from the export since they should - // already be included in the Godot templates, adding them - // again would cause conflicts. - return; - } - if (IsSharedObject(fileName)) { AddSharedObject(path, tags: new string[] { arch }, @@ -343,10 +337,19 @@ namespace GodotTools.Export return; } - static bool IsSharedObject(string fileName) + bool IsSharedObject(string fileName) { - if (fileName.EndsWith(".so") || fileName.EndsWith(".a") - || fileName.EndsWith(".dex")) + if (fileName.EndsWith(".jar")) + { + // Don't export the same jar twice. Otherwise we will have conflicts. + // This can happen when exporting for multiple architectures. Dotnet + // stores the jars in .godot/mono/temp/bin/Export[Debug|Release] per + // target architecture. Jars are cpu agnostic so only 1 is needed. + var jarName = Path.GetFileName(fileName); + return exportedJars.Add(jarName); + } + + if (fileName.EndsWith(".so") || fileName.EndsWith(".a") || fileName.EndsWith(".dex")) { return true; } diff --git a/platform/android/java/app/monoLibs/libSystem.Security.Cryptography.Native.Android.jar b/modules/mono/thirdparty/libSystem.Security.Cryptography.Native.Android.jar similarity index 100% rename from platform/android/java/app/monoLibs/libSystem.Security.Cryptography.Native.Android.jar rename to modules/mono/thirdparty/libSystem.Security.Cryptography.Native.Android.jar diff --git a/platform/android/java/app/build.gradle b/platform/android/java/app/build.gradle index 67b7fdffef1..d4c62dad3c0 100644 --- a/platform/android/java/app/build.gradle +++ b/platform/android/java/app/build.gradle @@ -70,7 +70,10 @@ dependencies { } // .NET dependencies - monoImplementation fileTree(dir: 'monoLibs', include: ['*.jar']) + String jar = '../../../../modules/mono/thirdparty/libSystem.Security.Cryptography.Native.Android.jar' + if (file(jar).exists()) { + monoImplementation files(jar) + } } android {