示例#1
0
        private static string GetAapt2Path()
        {
            var newestBuildToolsVersion = AndroidBuildTools.GetNewestBuildToolsVersion();
            var newestBuildToolsPath    = Path.Combine(AndroidBuildTools.GetBuildToolsPath(), newestBuildToolsVersion);

            return(Path.Combine(newestBuildToolsPath, "aapt2"));
        }
示例#2
0
        /// <summary>
        /// Checks the latest version of Android SDK Build-Tools that is installed, prompting to upgrade if necessary.
        /// Returns true if the latest version of Android SDK Build-Tools supports the "aapt2 convert" command,
        /// and false otherwise.
        /// </summary>
        public static bool CheckConvert()
        {
            var newestBuildToolsVersion = AndroidBuildTools.GetNewestBuildToolsVersion();

            if (newestBuildToolsVersion == null)
            {
                PlayInstantBuilder.DisplayBuildError(string.Format("Failed to locate {0}", BuildToolsDisplayName));
                return(false);
            }

            if (AndroidBuildTools.IsBuildToolsVersionAtLeast(newestBuildToolsVersion, BuildToolsMinimumVersion))
            {
                return(true);
            }

            var message = string.Format(
                "App Bundle creation requires {0} version {1} or later.\n\nClick \"OK\" to install {0} version {2}.",
                BuildToolsDisplayName, BuildToolsMinimumVersion, BuildToolsLatestVersion);

            if (PlayInstantBuilder.DisplayBuildErrorDialog(message))
            {
                AndroidSdkPackageInstaller.InstallPackage(BuildToolsPackageName, BuildToolsDisplayName);
            }

            return(false);
        }
        private static string GetApkSignerJarPath()
        {
            var newestBuildToolsVersion = AndroidBuildTools.GetNewestBuildToolsVersion();

            if (newestBuildToolsVersion == null)
            {
                return(null);
            }

            var newestBuildToolsPath = Path.Combine(AndroidBuildTools.GetBuildToolsPath(), newestBuildToolsVersion);
            var apkSignerJarPath     = Path.Combine(newestBuildToolsPath, "lib/apksigner.jar");

            if (File.Exists(apkSignerJarPath))
            {
                return(apkSignerJarPath);
            }

            Debug.LogErrorFormat("Failed to locate apksigner.jar at path: {0}", apkSignerJarPath);
            return(null);
        }