Skip to content

Commit 62b56a1

Browse files
committed
Add namespace to unityLibrary export.
1 parent 8cfb5e6 commit 62b56a1

File tree

1 file changed

+8
-0
lines changed
  • example/unity/DemoApp/Assets/FlutterUnityIntegration/Editor

1 file changed

+8
-0
lines changed

example/unity/DemoApp/Assets/FlutterUnityIntegration/Editor/Build.cs

+8
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,14 @@ private static void ModifyAndroidGradle(bool isPlugin)
332332
buildText = buildText.Replace(" + unityStreamingAssets.tokenize(', ')", "");
333333
buildText = Regex.Replace(buildText, "ndkPath \".*\"", "");
334334

335+
// check for namespace definition (Android gradle plugin 8+), add a backwards compatible version if it is missing.
336+
if(!buildText.Contains("namespace"))
337+
{
338+
buildText = buildText.Replace("compileOptions {",
339+
"if (project.android.hasProperty(\"namespace\")) {\n namespace 'com.unity3d.player'\n }\n\n compileOptions {"
340+
);
341+
}
342+
335343
if(isPlugin)
336344
{
337345
buildText = Regex.Replace(buildText, @"implementation\(name: 'androidx.* ext:'aar'\)", "\n");

0 commit comments

Comments
 (0)