Unity unable to publish to Play Console - Invalid app signature - android

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

Related

Unable to install the .apk generated from .aab due to signing issues

I have installed Android Studio Dolphin | 2021.3.1 for Mac (~993 MiB) recently. I have created .aab file from Build -> Generate Signed Bundle / APK. While generating .aab I have given all the required details like keystore file path, alias and password. After generating .aab I tired to generate .apk from .aab by using following command,
sudo bundletool build-apks --bundle=<.aab location> --output=<.apk location>
Then I encountered with following warning,
WARNING: The APKs won't be signed and thus not installable unless you
also pass a keystore via the flag --ks. See the command help for more
information.
Now, If I am unable to install the generated .apk file due to signing issues.
May I know the reason behind this warning though I have given all the required details while generating .aab?
It's a requirement of the Android platform that all APKs must be signed to be installed on a device, so your requirement of "installing unsigned APKs" is simply not possible.
Solutions to get apk from aab

Can't upload signed apk that targetSdkVersion is 30

I generated a signed apk with a target sdk version of 30. (Android 11). I know it wasn't officially released but my application is ready for the new changes. I am trying to upload it to the google play console but facing the error:
You uploaded an APK with an invalid signature (learn more about
signing). Error from apksigner: ERROR:
MIN_SIG_SCHEME_FOR_TARGET_SDK_NOT_MET: Target SDK version 30 requires
a minimum of signature scheme v2; the APK is not signed with this or a
later signature scheme.
What I tried to do:
I double checked that I selected v2 (Full APK Singature) when I generated the apk.
I tried to manually sign the apk using apksigner.
Nothing worked. I'm wondering if it's not working since the version wasn't released yet. However, I understand that it suppose to work from the documents.
Short answer for those building Cordova projects on the command line: You'll need to switch from jarsigner to apksigner and set up the command accordingly. NOTE: You'll need to run zipalign before apksigner, which is different from how we used to use it with jarsigner. Here's an example:
cordova build android --release
zipalign -f 4 platforms/android/app/build/outputs/apk/release/myapp-release-unsigned.apk myapp.apk
apksigner sign --ks my-ks.keystore --ks-pass file:my-passfile.txt --v1-signing-enabled true --v2-signing-enabled true myapp.apk
... upload apk to store or whatever ...
Select both V1 and V2(Full Apk Signature) while generating the apk. This solved my issue which was similar to yours.
Generate an App Bundle instead of an APK.
In my app I targeted api 30 and published the bundle without problems.
I had a tough time solving that issue. The following helped me resolve it completely.
Add the following 2 lines in config.xml (root directory of the Cordova project)
<preference name="android-minSdkVersion" value="30"/>
<preference name="android-targetSdkVersion" value="30"/>
Import your project in AndroidStudio
Under Build Click on Generate Signed Bundle / APK
Select Android App Bundle
Update Keystore file/password and all requested details (Please select the option of the export encrypted key, as you will require to upload this on the playstore)
Select Release
Before uploading the app bundle you need to upload the certificate (the one you download in step 4)
(optional step) You will also see an auto-generated App signing key certificate you can download that if you want
Upload the App Bundle & you can now release the App to PlayStore.

apksigner, zipalign and jarsigner not working as expected

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.

can not install apk after generate signed apk in Android studio

I want to publish my app to google play. So I follow this link.
I created a keystore, and built app-release.apk successfully. But when I install APK to my device, it take error:
~/Android/Sdk/platform-tools$ ./adb install ~/Downloads/libraries/LolliPin/app/app-release.apk
[100%] /data/local/tmp/app-release.apk
pkg: /data/local/tmp/app-release.apk
Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]
When upload to Developer Console, the site say app has not signed.
I try again using manual steps: jarsigned --> zipalign --> apksigner but it is not run.
Please tell me the solution. Many thanks!
UPDATE: when I verified the apk (created by android studio --> generate apk signed) by apksigned, it show error:
~/Android/Sdk/build-tools/25.0.2$ ./apksigner verify /home/haitt22/test/app-release.apk
DOES NOT VERIFY
ERROR: No JAR signatures
UPDATE 2: when i signed it using apksigner in build-tool, log:
/apksigner sign --ks /home/haitt22/test/test.jks /home/ubuntu/test/app-release-aligned.apk
Keystore password for signer #1:
Exception in thread "main" java.lang.IllegalAccessError: class com.android.apksig.internal.apk.v1.V1SchemeSigner (in unnamed module #0x646d64ab) cannot access class sun.security.x509.AlgorithmId (in module java.base) because module java.base does not export sun.security.x509 to unnamed module #0x646d64ab
at com.android.apksig.internal.apk.v1.V1SchemeSigner.getSupportedAlgorithmId(V1SchemeSigner.java:625)
at com.android.apksig.internal.apk.v1.V1SchemeSigner.<clinit>(V1SchemeSigner.java:541)
at com.android.apksig.DefaultApkSignerEngine.<init>(DefaultApkSignerEngine.java:149)
at com.android.apksig.DefaultApkSignerEngine.<init>(DefaultApkSignerEngine.java:52)
at com.android.apksig.DefaultApkSignerEngine$Builder.build(DefaultApkSignerEngine.java:902)
at com.android.apksig.ApkSigner.sign(ApkSigner.java:259)
at com.android.apksig.ApkSigner.sign(ApkSigner.java:178)
at com.android.apksigner.ApkSignerTool.sign(ApkSignerTool.java:277)
at com.android.apksigner.ApkSignerTool.main(ApkSignerTool.java:89)
You need to make sure that, both Jar signature and APK signature are checked:
Use OpenJDK 8. Java 9 is causing this problem

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