I have an Android Studio project and a C# script that makes a release build of this project: first I make an unsigned release APK using CMD.exe, and then I use jarsigner to sign the application(this is needed to build apk without even opening Android Studio and being able to change key store).
I have updated Android Studio lately and now when I generate signed APK right from the IDE there is one new option: Signature version - V1 (Jar Signature) and V2 (Full APK Signature). After this update if I build an APK using my C# script the APK file is not accepted by Google Play: it says that my APK is not optimized and I should use optimization instrument and re-upload. I believe these two changes are related.
My question is how do I choose Signature version using jarsigner? I have found no related options in jarsigner and gradlew help.
Here is my C# simplified code:
//assemble an unsigned APK
Process cmd = new Process()
cmd.StartInfo.FileName = "CMD.exe";
cmd.StartInfo.RedirectStandardInput = true;
cmd.StartInfo.UseShellExecute = false;
cmd.Start();
cmd.StandardInput.WriteLine(@"cd /d """ + Application.StartupPath + @"""");
cmd.StandardInput.WriteLine(@"gradlew assembleRelease");
cmd.StandardInput.Flush();
cmd.StandardInput.Close();
cmd.WaitForExit();
//sign the APK
string args = @"-keystore """ + keyPath + @""" -storepass " + alias +
@" """ + Application.StartupPath +
@"\app\build\outputs\apk\app-release-unsigned.apk"" " + aliasPas;
Process java = new Process();
java.StartInfo.FileName = Path.Combine(GetJavaInstallationPath(), "bin\\jarsigner.exe");
java.StartInfo.Arguments = args;
java.StartInfo.UseShellExecute = false;
java.Start();
java.WaitForExit();