private void StartDownload()
        {
            Debug.Log("Downloading bundletool...");
            var bundletoolUri = string.Format(
                "https://github.com/google/bundletool/releases/download/{0}/bundletool-all-{0}.jar",
                Bundletool.BundletoolVersion);

            _downloadRequest =
                GooglePlayInstantUtils.StartFileDownload(bundletoolUri, Bundletool.GetBundletoolJarPath());
        }
        private void Update()
        {
            if (_downloadRequest == null)
            {
                return;
            }

            if (_downloadRequest.isDone)
            {
                EditorUtility.ClearProgressBar();

                if (GooglePlayInstantUtils.IsNetworkError(_downloadRequest))
                {
                    var downloadRequestError = _downloadRequest.error;
                    _downloadRequest.Dispose();
                    _downloadRequest = null;

                    Debug.LogErrorFormat("Bundletool download error: {0}", downloadRequestError);
                    if (EditorUtility.DisplayDialog("Download Failed",
                                                    string.Format("{0}\n\nClick \"{1}\" to retry.", downloadRequestError, WindowUtils.OkButtonText),
                                                    WindowUtils.OkButtonText,
                                                    WindowUtils.CancelButtonText))
                    {
                        StartDownload();
                    }
                    else
                    {
                        EditorApplication.delayCall += Close;
                    }

                    return;
                }

                // Download succeeded.
                var bundletoolJarPath = Bundletool.GetBundletoolJarPath();
                GooglePlayInstantUtils.FinishFileDownload(_downloadRequest, bundletoolJarPath);
                _downloadRequest.Dispose();
                _downloadRequest = null;

                Debug.LogFormat("Bundletool downloaded: {0}", bundletoolJarPath);
                var message = string.Format(
                    "Bundletool has been downloaded to your project's \"Library\" directory: {0}", bundletoolJarPath);
                if (EditorUtility.DisplayDialog("Download Complete", message, WindowUtils.OkButtonText))
                {
                    EditorApplication.delayCall += Close;
                }

                return;
            }

            // Download is in progress.
            if (EditorUtility.DisplayCancelableProgressBar(
                    "Downloading bundletool", null, _downloadRequest.downloadProgress))
            {
                EditorUtility.ClearProgressBar();
                _downloadRequest.Abort();
                _downloadRequest.Dispose();
                _downloadRequest = null;
                Debug.Log("Cancelled bundletool download.");
            }
        }