Skip to content

Commit 00f5c8f

Browse files
authored
Add export check for "game_view_content_description" in strings.xml.
1 parent 99188df commit 00f5c8f

File tree

1 file changed

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

1 file changed

+15
-0
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,21 @@ private static void ModifyAndroidGradle(bool isPlugin)
367367
var proguardText = File.ReadAllText(proguardFile);
368368
proguardText = proguardText.Replace("-ignorewarnings", "-keep class com.xraph.plugin.** { *; }\n-keep class com.unity3d.plugin.* { *; }\n-ignorewarnings");
369369
File.WriteAllText(proguardFile, proguardText);
370+
371+
// Make sure "game_view_content_description" is in strings.xml
372+
var stringsFile = Path.Combine(APKPath, "launcher", "src", "main", "res", "values", "strings.xml");
373+
if(File.Exists(stringsFile))
374+
{
375+
var stringsText = File.ReadAllText(stringsFile);
376+
if(!stringsText.Contains("game_view_content_description"))
377+
{
378+
stringsText = stringsText.Replace("<resources>", "<resources>\n <string name=\"game_view_content_description\">Game view</string>");
379+
File.WriteAllText(stringsFile, stringsText);
380+
}
381+
} else
382+
{
383+
Debug.LogError("Android res/values/strings.xml file not found during export.");
384+
}
370385
}
371386

372387
private static void BuildIOS(String path, bool isReleaseBuild)

0 commit comments

Comments
 (0)