Beispiel #1
0
 private void DoAlign(string signedApkFilename, string finalApkFilename)
 {
     OnProgress("准备对齐……");
     File.Delete(finalApkFilename);
     ProcessInvoker.Execute(this, "tools\\zipalign.exe",
                            string.Format("-f -v 4 {0} {1}", signedApkFilename, finalApkFilename),
                            true);
     if (!File.Exists(finalApkFilename))
     {
         throw new Exception("对齐失败!");
     }
     File.Delete(signedApkFilename);
     OnProgress("对齐完成");
 }
Beispiel #2
0
            private void DoPack(string baseName, string sourDir, AndroidManifest am, string channel, string destFilename)
            {
                OnProgress("准备打包:" + channel);
                string buildDir = Utils.MakeFilename(sourDir, "build");

                if (Directory.Exists(buildDir))
                {
                    Directory.Delete(buildDir, true);
                }
                am.Channel = channel;
                am.Save();
                ProcessInvoker.Execute(this, ProcessInvoker.BuildExeFullPath("java.exe"),
                                       String.Format("-jar tools\\apktool.jar b -f -o {0} {1}", destFilename, sourDir), true);
                OnProgress("打包完成");
            }
Beispiel #3
0
 private void DoSign(Project project, string unsignedApkFilename, string signedApkFilename)
 {
     OnProgress("准备签名:" + unsignedApkFilename);
     File.Delete(signedApkFilename);
     ProcessInvoker.Execute(this, ProcessInvoker.BuildExeFullPath("jarsigner.exe"),
                            string.Format("-keystore \"{0}\" -storepass \"{1}\" -digestalg SHA1 -sigalg MD5withRSA -keypass \"{2}\" -signedjar \"{3}\" \"{4}\" \"{5}\"",
                                          project.KeyStore, project.StorePassword, project.AliasPassword, signedApkFilename, unsignedApkFilename, project.Alias),
                            false
                            );
     if (!File.Exists(signedApkFilename))
     {
         throw new Exception("签名失败!");
     }
     OnProgress("签名完成");
 }
Beispiel #4
0
            private AndroidManifest DoUnpack(string apkName, string outputDir)
            {
                if (Directory.Exists(outputDir))
                {
                    OnProgress("删除临时目录……");
                    Directory.Delete(outputDir, true);
                }

                OnProgress("准备对APK进行解包……");
                ProcessInvoker.Execute(this, ProcessInvoker.BuildExeFullPath("java.exe"),
                                       String.Format("-jar tools\\apktool.jar d -f -s -o {0} {1}", outputDir, apkName), true);
                OnProgress("解包完成!");
                //
                OnProgress("解析AndroidManifest.xml……");
                AndroidManifest am = new AndroidManifest(outputDir);

                return(am);
            }