public static void BuildAPK(string distributionList) { try { var folder = BuildSettings.BaseBuildFolder; var platformFolder = BuildSettings.BuildFolder; // moko: changed to do a debug dump of all builder job info first var date = System.DateTime.Now.ToString("dd/MM/yy HH:mm"); string header = "*******************************************************************************\n"; header += "Building to " + folder + " @" + date; Debug.Log(header); Debug.Log("Build Setting Parameters:\n" + BuildSettings.ToString()); Debug.Log("Environment Setting Parameters:\n" + EnvironmentUtils.GetEnvirnomentDetails()); // cleanup GeneralUtils.DeleteDirectory(platformFolder, true); // mko: cleaning up build folder GeneralUtils.DeleteDirectory("Android", true); // mko: cleaning up build folder Directory.CreateDirectory(folder); Directory.CreateDirectory(platformFolder); var version = "1.0"; try { var parts = PlayerSettings.bundleVersion.Split('.'); version = parts[0] + "." + parts[1]; } catch { } // moko: prepend #define instead of replace in case there is some specific settings stored in playerSetting string defines = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android); if (_debug) { PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android, "USE_DEBUG;" + defines); } else { if (_useobb) { PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android, "USE_OBB;" + defines); } } var cl = EnvironmentUtils.Get("BUILD_CL", "0"); var desc = "Android " + date + " CL: " + cl + "\n"; var notes = (ArrayList)EB.JSON.Parse(EnvironmentUtils.Get("BUILD_NOTES", "[]")); PlayerSettings.bundleVersion = version + "." + cl; PlayerSettings.applicationIdentifier = BuildSettings.BundleIdentifier; PlayerSettings.use32BitDisplayBuffer = false; WriteVersionFile(version + "." + cl); Debug.Log("Desc: " + desc); // disable scenes that are the tracks var settings = new List <EditorBuildSettingsScene>(); foreach (var setting in EditorBuildSettings.scenes) { if (setting.path.Contains("tracks")) { setting.enabled = !_useobb; } if (_debug == false && setting.path.Contains("selector")) { setting.enabled = false; } settings.Add(setting); } EditorBuildSettings.scenes = settings.ToArray(); // build bundles DisplayProgressBar("Building", "Building Bundles", 0.0f); Bundler.BundleOptions bundleOptions = Bundler.BundleOptions.Force | Bundler.BundleOptions.SkipOgg; if (_debug || (_useobb == false)) { bundleOptions |= Bundler.BundleOptions.Extended; } Bundler.BuildAll(BuildSettings.BundlerConfigFolder, bundleOptions); // build the player var apkPath = Path.Combine(folder, cl + ".apk"); PlayerSettings.Android.bundleVersionCode = int.Parse(cl); if (!_debug) { PlayerSettings.bundleVersion = BuildSettings.Version; } else { PlayerSettings.Android.bundleVersionCode = 1; } Debug.Log("Building to " + apkPath); AndroidUtils.BuildPlayer(apkPath, BuildOptions.None); if (!File.Exists(apkPath)) { throw new System.Exception("Failed to build apk!"); } // upload to s3 //string url = S3Utils.Put( apkPath, string.Format("{0}-{1}-{2}.apk", PlayerSettings.bundleIdentifier, PlayerSettings.bundleVersion, cl) ); string url = apkPath; // send email var data = new Hashtable(); data["cl"] = cl; data["title"] = desc; data["url"] = url; data["notes"] = notes; data["obb"] = ""; if (!_debug && _useobb) { data["obb"] = BuildOBB(); UploadApkFiles(apkPath, WWWUtils.Environment.API); } Email(distributionList, BuildSettings.ProjectName + " - Android Build: " + PlayerSettings.bundleVersion + (_debug ? " DEBUG" : " SUBMISSION"), File.ReadAllText("Assets/Editor/EB.Core.Editor/Build/Email/androidbuild.txt"), data); Done(); } catch (System.Exception e) { Debug.Log("Build Failed: exception: " + e.ToString()); Failed(e); } ClearProgressBar(); }