ChatGPT解决这个技术问题 Extra ChatGPT

Android Signed APK showing as Unsigned APK when trying to upload to production

I signed my APK in Android Studio 2.3 (build->generate signed APK). When I'm trying to upload it to Google Play store it is showing the error that I've uploaded unsigned APK. Could anyone answer why it is happening and how to solve it?

could you send the error message?
It uploaded successfully when I checked V1 (Jar Signature) instead of V2 (Full APK Signature) while generating the signed APK.

N
Nani Kalyan

It uploaded successfully when I checked V1 (Jar Signature) instead of V2 (Full APK Signature) while generating the signed APK in Android Studio 2.3


I had both checkboxes checked: Jar Signature and Full APK Signature. This answer provided the necessary insight.
Why check only V1 when V2 is available for signing? You should have selected both V1 and V2 and accept Piyush Kukadiyas answer.
I'll be damned, it worked! But why? (I'm running AS 3.1.3).
P
Piyush Kukadiya

Android 7.0 introduces APK Signature Scheme v2, a new app-signing scheme that offers faster app install times and more protection against unauthorized alterations to APK files.

While generating signed apk there are two checkbox .

V1 (Jar Signature) V2 (Full apk Signature)

There are three choices available to us:

select V1 (For older version of signing) - apk gets uploaded successfully select V2 (For newer version of signing) - Please note that selecting this alone will not work. select V1 and V2 (For older and newer version) - apk gets uploaded successfully

Why selecting V2 alone does not work ?

Because APK Signature Scheme v2 was introduced in Android 7.0 (Nougat). To make a APK installable on Android 6.0 (Marshmallow) and older devices, the APK should be signed using JAR signing before being signed with the v2 scheme.

For more information jump here


Thanks for the explanation, but why does Google complain when I have both V1 and V2 checked?
@ScottBiggs what is their complaint when you have both checked ?
A
Ahmad

Signed for Both v1 and v2. It will upload Successfully.


S
Sanoop Surendran

This is because you are using only v2 signature while taking release build.

So what is v1 and v2 mentioned?

v1 is the default signing mechanism and v2 is the newest mechanism added, which verifies much faster. This means v2-signed APKs install/update a bit faster on Android Nougat (Android 7.0, API Level 24) and newer.

So what should you do?

If you want to sign app without any changes

Check v1 (jar Signature only) which is the default.

If you want the newest signature and support for 7.x versions

Check v2 (Full Apk Signature) Which also reduces app size.

If you want app to be smaller, able to install faster and compatible with all Android versions.

Check both v1 and v2.

PS: Only applicable for signing apps with Studio, other than using pipes to build.

For more refereces Link


P
Piyush Patel

How To sign APK using V2

https://developer.android.com/studio/command-line/apksigner.html

Step 1) Android Studio, select View > Tool Windows > Terminal

    gradlew assembleRelease

2) Align the unsigned APK using zipalign:

zipalign -v -p 4 my-app-unsigned.apk my-app-unsigned-aligned.apk

3) Sign your APK with your private key using apksigner:

apksigner sign --ks my-release-key.jks my-app-unsigned-aligned.apk --out my-app-release.apk

Note: To use the apksigner tool, you must have revision 24.0.3 or higher of the Android SDK Build Tools installed. You can update this package using the SDK Manager.

4) Verify that your APK is signed:

apksigner verify my-app-release.apk

Note: step 2 to 4 Perform in Command Prompt G:\AndroidStudio\Sdk\build-tools\25.0.0\


sir i tried above procedure but i got below error in ---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.?
@Kapilsoni the step 2 is missing. You need to goto SDK -> build tools -> 30.0.2 There you will find zipalign
sir but if i generted build via above procedure got build not installed errors i device
First, generate a build, and then after applying these steps on APK and must be signed
yes sir done but i got another issue in play console--You uploaded an APK that is not signed with the upload certificate. You must use the same certificate. The upload certificate has fingerprint:
D
D.Rosado

If you reach this, use Android Studio 3.3 and the error keeps coming up no matter you check the Signature checkboxes or not, try to manually delete the app/build folder.

Source: https://stackoverflow.com/a/54213942/787511


M
Mehran Zamani

It is a problem from Google and it is issued two days ago in this page


Upload failed You uploaded an unsigned APK. You need to create a signed APK.
S
Sudheer Kumar Palchuri

As per the attached screenshot, Select both V1(Jar Signature) and V2(Full APK Signature). It will work.

https://i.stack.imgur.com/MwEfP.png