bitrise-steplib / steps-google-play-deploy

MIT License
54 stars 38 forks source link

Target SDK version 31 requires a minimum of signature scheme v2 #140

Closed thenderson55 closed 2 years ago

thenderson55 commented 2 years ago

To get my React Native Android app to build locally, in android/build.gradle I needed to upgrade:

compileSdkVersion = 29  ->  31
targetSdkVersion = 29  ->  31

In Bitrise, my build now fails at google-play-deploy ( version 3.7.2 ) with this message:

Upload apks or app bundles
Uploading /Users/vagrant/deploy/app-[REDACTED]-bitrise-signed.apk 1/1

Failed to upload application(s): failed to upload apk, error: googleapi: 
Error 403: APK signature is invalid or does not exist. Error from apksigner:
ERROR: MIN_SIG_SCHEME_FOR_TARGET_SDK_NOT_MET: 
Target SDK version 31 requires a minimum of signature scheme v2; 
the APK is not signed with this or a later signature scheme, forbidden

I tried adding v2SigningEnabled true in android/app/build.gradle signingConfigs but it didn't change anything.

Also tried with targeting sdk version 30 but it failed similar to 29 - Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.

Any advice on how to fix this?

thenderson55 commented 2 years ago

I fixed it.

In “Android sign” workflow step, change “Enables apksigner“ to true.

Also may need to add android:exported="false" to plugins using intent-filter in the AndroidManifest.xml.

See answer here:

https://stackoverflow.com/questions/70695372/you-uploaded-an-apk-or-android-app-bundle-which-has-an-activity-activity-alias

bitrise-coresteps-bot commented 2 years ago

Hello there, I'm a bot. On behalf of the community I thank you for opening this issue.

To help our human contributors focus on the most relevant reports, I check up on old issues to see if they're still relevant. This issue has had no activity for 90 days, so I marked it as stale.

The community would appreciate if you could check if the issue still persists. If it isn't, please close it. If the issue persists, and you'd like to remove the stale label, you simply need to leave a comment. Your comment can be as simple as "still important to me".

If no comment left within 21 days, this issue will be closed.

yitelu commented 2 years ago

I’ve encountered the scenario of error failed to upload application(s): failed to upload apk, error: googleapi: Error 403: APK signature is invalid or does not exist

This is how I solved the error with my approach and my app is deployed to GooglePlayStore via the Bitrise CICD deployment successfully.

  1. The initial app/build.gradle config was set targetSdk 32 and then I changed to targetSdk 30
  2. Originally my app was published in AAB instead of APK, the default build type is APK in Bitrise workflow Android Build, so I changed that build type to AAB
  3. Then I was successfully auto deploy to GooglePlayStore production channel via Bitrise CICD

Screen Shot 2022-06-17 at 10 57 26 AM

bitrise-coresteps-bot commented 2 years ago

Hello there, I'm a bot. On behalf of the community I thank you for opening this issue.

To help our human contributors focus on the most relevant reports, I check up on old issues to see if they're still relevant. This issue has had no activity for 90 days, so I marked it as stale.

The community would appreciate if you could check if the issue still persists. If it isn't, please close it. If the issue persists, and you'd like to remove the stale label, you simply need to leave a comment. Your comment can be as simple as "still important to me".

If no comment left within 21 days, this issue will be closed.

bitrise-coresteps-bot commented 2 years ago

I'll close this issue as it doesn't seem to be relevant anymore. We believe an old issue probably has a bunch of context that's no longer relevant, therefore, if the problem still persists, please open a new issue.