public void OnPostGenerateGradleAndroidProject(string path)
        {
            if (!PlayInstantBuildConfiguration.IsInstantBuildType())
            {
                return;
            }

            // Update the final merged AndroidManifest.xml prior to the gradle build.
            var manifestPath = Path.Combine(path, "src/main/AndroidManifest.xml");

            Debug.LogFormat("Updating manifest for Play Instant: {0}", manifestPath);

            Uri uri        = null;
            var instantUrl = PlayInstantBuildConfiguration.InstantUrl;

            if (!string.IsNullOrEmpty(instantUrl))
            {
                uri = new Uri(instantUrl);
            }

            var doc          = XDocument.Load(manifestPath);
            var errorMessage = AndroidManifestHelper.ConvertManifestToInstant(doc, uri);

            if (errorMessage != null)
            {
                PlayInstantBuilder.DisplayBuildError(
                    string.Format("Error updating AndroidManifest.xml: {0}", errorMessage));
                return;
            }

            doc.Save(manifestPath);
        }
Esempio n. 2
0
        public static void Build()
        {
            ConfigureProject();
            var buildPlayerOptions = PlayInstantBuilder.CreateBuildPlayerOptions(ApkPath, BuildOptions.None);

            PlayInstantBuilder.BuildAndSign(buildPlayerOptions);
        }
        public static void Build()
        {
            PlayerSettings.applicationIdentifier = "com.google.android.instantapps.samples.unity.testapp";
            PlayerSettings.companyName           = "Google";
            PlayerSettings.productName           = "testapp";

            CommandLineBuilder.ConfigureProject(TestScenePaths);


            var outputFilePrefix = CommandLineBuilder.GetOutputFilePrefix();
            var apkPath          = outputFilePrefix + ".apk";
            var aabPath          = outputFilePrefix + ".aab";

            var buildPlayerOptions = PlayInstantBuilder.CreateBuildPlayerOptions(apkPath, BuildOptions.None);

            if (!PlayInstantBuilder.BuildAndSign(buildPlayerOptions))
            {
                throw new Exception("APK build failed");
            }

            DownloadBundletoolIfNecessary();
            if (!AppBundlePublisher.Build(aabPath))
            {
                throw new Exception("AAB build failed");
            }
        }
        public static void Build()
        {
            PlayerSettings.applicationIdentifier = "com.google.android.instantapps.samples.unity.testapp";
            PlayerSettings.companyName           = "Google";
            PlayerSettings.productName           = "testapp";

            CommandLineBuilder.ConfigureProject(TestScenePaths);

            // Build APK.
            var apkPath            = CommandLineBuilder.GetApkPath();
            var buildPlayerOptions = PlayInstantBuilder.CreateBuildPlayerOptions(apkPath, BuildOptions.None);

            if (!PlayInstantBuilder.BuildAndSign(buildPlayerOptions))
            {
                throw new Exception("APK build failed");
            }

            // Also Build an AAB to test Android App Bundle build.
            DownloadBundletoolIfNecessary();
            var aabPath = apkPath.Substring(0, apkPath.Length - 3) + "aab";

            if (!AppBundlePublisher.Build(aabPath))
            {
                throw new Exception("AAB build failed");
            }
        }
Esempio n. 5
0
        public static void Build()
        {
            PlayerSettings.applicationIdentifier = "com.google.android.instantapps.samples.unity.sphereblast";
            PlayerSettings.companyName           = "Google";
            PlayerSettings.productName           = "Sphere Blast";

            CommandLineBuilder.ConfigureProject(ScenesInBuild);

            var apkPath            = CommandLineBuilder.GetOutputFilePrefix() + ".apk";
            var buildPlayerOptions = PlayInstantBuilder.CreateBuildPlayerOptions(apkPath, BuildOptions.None);

            if (!PlayInstantBuilder.BuildAndSign(buildPlayerOptions))
            {
                throw new Exception("APK build failed");
            }
        }