apksigner, zipalign and jarsigner not working as expected - android

I have created a Xamarin Form application using Visual Studio 2017 in Windows 10 and archived the android application to APK file.
When I upload the APK to Google Play console to update my existing app, it says the APK is not signed. Then I used this command to sign the APK using the same certificate
apksigner sign --ks <KEYSTORE_FILE_NAME> --ks-key-alias <ALIAS_NAME> <APK_FILE_NAME>
When I try to upload the signed APK, it says the APK is not zipaligned. Then I used this command to zipalign
zipalign -f -v 4 <OLD_APK_FILE_NAME> <NEW_APK_FILE_NAME>
When I upload the zipaligned APK to console, it says the APK is not signed. After I sign using apksigner it says it is not zipaligned. I am keep on circulating in the same circle again and again.
Even after I zipalign the APK first and then sign, Same error messages are displaying again and again in same circle.
Even if I used jarsigner, the situation is same.
I followed the steps given here
https://developer.xamarin.com/guides/android/deployment,_testing,_and_metrics/publishing/signing-the-app-package/manually-signing-the-apk/
But the APK not getting uploaded. What am I doing wrong?
Please note this is not a duplicate question.

apksigner requires you to zipalign prior to signing. jarsigner requires you to zipalign after signing. This is documented in the zipalign docs.

Related

Troubles in building singed apk again in EXPO

Everybody.
I have a trouble to build signed apk again for upgrading version from 1.0 to 1.1.
Followings are what i did.
First i built an apk by choosing 1) Let Expo handle the process!.
And then uploaded the apk to google store.
Nowdays, i have to upgrade the version, but i don't have any keystore file.
These are what i tried to do.
Downloaded upload_cert.der file from Google store.
Created a keystore file by this command
keytool.exe -importcert -file upload_cert.der -keystore <keystorefile>.keystore
Built an apk by choosing 2) I want to upload my own keystore!
But can't install the apk with an error.
When i run this command keytool -printcert -jarfile <apkname>.apk,
this message appears Not a signed jar file
So Could you everybody let me know please...
Is this really impossible to upgrade apk without original keystore
Or how to create a correct keystore from upload_cert.der file
Thanks.

Unity unable to publish to Play Console - Invalid app signature

Here is what I get after waiting for the upload. I'm using latest Unity (2017.3.0f3) with JDK 8 (because 9 wasn't even building). Now the project builds but I can't deploy it to the console nor can I to the Emulator.
Note, I did assign my keystore file and I did write the passwords. I'm not uploading a development build, I double checked that. For the build I was using the old .25 tools (inside the sdk folder I replaced the existing ones). I did that so that I can get a build.
I looked for the error message of course, but couldn't find anything useful.
Might be your app signing step failed while producing final apk.
As mentioned here, try resigning your apk with below sample commands
apksigner sign --ks my-release-key.jks --out my-app-release.apk my-app-unsigned-aligned.apk
and validate same using
apksigner verify my-app-release.apk

APK Signed with same certificate and verified, still not able to upload to Google play

I am facing some unexpected problem while trying to upload the latest exported signed APK, earlier i was using eclipse and now i am using android studio and i have followed all steps and exported the signed apk, Also i verified both old apk last uploaded and this exported release apk and verified using below command
$ jarsigner -verify -verbose -certs my_application.apk
Both result looks same, which means the apk is signed with same certificate, Still when i try to upload to google play its showing me below error message.What else i need to do?
Solution
In one of the Library module inside Android Studio, Below line was existing
Debuggable==true
I Removed it, then I was able to export the APK.
Do you remove the tag "debuggable true" from your build.gradle file?

Signed Package, Am I ready now?

after doing right-click on package -> Export signed application package... -> verify with valid keystore i got an APK.
To get sure i used jarsigner to check if my app is correctly signed.
$ jarsigner -verify -verbose -certs my_application.apk
and i got jar verified as response.
Is my APK now correctly signed with a release key? Ready to upload?
Also how can i check, like it is recommended by the android documentation, my signed apk on my phone? (To check if proguard didn't cut of something which is necessary for my app and so on..)
Any help is appreciated.
If your APK is not signed correctly, you will not be able to upload it to the Play-Store.

You uploaded an APK that is not zip aligned error

I have just finished and signed the apk through android studio,
then I have did an apk protect through apkprotect.com
when I am trying to upload the apk to play store I got this error " You uploaded an APK that is not zip aligned. You will need to run a zip align tool on your APK and upload it again. "
if I upload the original apk I got no errors,
I have tried to add zipalign true in the build.gradle but nothing happened
I have tried also disable and enable proguard .
You can run zipalign manually in command line:
zipalign [-f] [-v] <alignment> infile.apk outfile.apk
Note that zipalign is located inside ${sdk.dir}\tools
For more details visit zipalign
[Update]
Also, If you need to sign it you can run:
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore YOURKEYSTORE unsigned.apk alias_name
(jarsigner is located inside java JDK_HOME/bin)
I got the same "You uploaded an APK that is not zip aligned... blah, blah" error when by mistake I tried to upload a DEBUG version of my .apk file to Google Play. It's a bit misleading error because the real problem is that you cannot distribute a debug version which additionally is not signed with your Google Android Developer key. (You can only upload an .apk compiled as release version, and it must be signed, which happens in the same step, at least if you're using Eclipse).
Make sure you distribute an .apk file which is your Signed Release version, as described here:
http://developer.android.com/tools/publishing/app-signing.html#releasecompile
This question and its answers are old; so we expect things to change. As of today, the zipalign tool is in the ANDROID_HOME directory under build-tools/[version]/ so my path is currently:
/android-sdk/build-tools/22.0.0/zipalign
Using the zipalign tool is not necessarily the answer here though, what you actually need to do is sign your apk.
Steps if using Xamarin for VS2017:
Build project
Right click and Archive project
Use Ad Hoc distribution channel
Sign your APK with your Signing Identity and Save As to produce an APK that is ZIP aligned.
Your APK can be uploaded to Google Play.
I was using Cordova, uploaded a signed APK but still got this error.
The ziptool is what helped me, it's located at ~AndroidSDK\build-tools\24.0.0\zipalign.exe
So for example :
"~\AndroidSDK\build-tools\24.0.0\zipalign.exe" -f -v 4 android-release-signed.apk android-release-signed-zipaligned.apk
I was using Cordova and the command line getting this error. I opened the project in Android Studio and used Android Studio to build the signed apk and the error went away.
When using the Cordova node.js CLI without going through Android Studio, it is necessary to update the PATH environmental variable to include the android build tools:
%ANDROID_HOME%\build-tools\29.0.2
Obviously the version number will change over time. Remember to close any CLI windows and re-open them to recognize the newly added path.

Categories

Resources