- Home /
Issue in Build APk and Export through Script
Hi Members,
I need an urgent help. I am trying to export and Build for Android and IPhone through C# script.
Build APK, I am doing for Android and IPhone using below commands.
if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.Android) {
EditorUserBuildSettings.SwitchActiveBuildTarget (BuildTarget.Android);
BuildPipeline.BuildPlayer (null, Path , BuildTarget.Android, BuildOptions.None);
}
else if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.iPhone) {
EditorUserBuildSettings.SwitchActiveBuildTarget (BuildTarget.iphone);
BuildPipeline.BuildPlayer (null, Path , BuildTarget.iPhone, BuildOptions.None);
}
But I see Build happens two times both for Android and Iphone and i get some unusual errors. Like: GUI Window tries to begin rendering while something else has not finished rendering! Either you have a recursive OnGUI rendering, or previous OnGUI did not clean up properly. Error building Player because scripts had compiler errors device.IsInsideFrame()
For Android Export, I am doing like this
if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.Android) {
EditorUserBuildSettings.SwitchActiveBuildTarget (BuildTarget.Android);
BuildPipeline.BuildPlayer (null, Path, BuildTarget.Android, BuildOptions.AcceptExternalModificationsToPlayer);
}
In this case also i get build happening two times and these errors
Internal compiler error. See the console log for more information. output was: Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded. GUI Window tries to begin rendering while something else has not finished rendering! Either you have a recursive OnGUI rendering, or previous OnGUI did not clean up properly. Error building Player because scripts had compiler errors
I am using Unity Pro. I don't have any compilation error also.
Please help me in fixing Build APK, and Export issues asap. Am I using wrong script? Please rectify.
Thanks & regards, Anoop.
Your answer
![](https://koobas.hobune.stream/wayback/20220613174419im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How can stop the repeat random number (Random.Range) 2 Answers
Basic U/S question, how to do 'common' routines... 1 Answer
how to call a class on click 1 Answer
How do Ensure that a series of int's are never the same? 1 Answer
Instantiate prefab randomly but not in already genrated position 2 Answers