Flutter: Your Android App Bundle is signed with the wrong key - flutter

I'm new to Flutter. I have created an app and now I'm trying to upload it to google play (Open testing track). Previously, I have uploaded a react-native version of my app. Now I would like to replace it with the flutter version. I have carefully followed the instructions from the official guidelines. No matter what I do, I'm getting the error:
Your Android App Bundle is signed with the wrong key. Ensure that your App Bundle is signed with the correct signing key and try again
I have looked at a number of similar issues on Stackoverflow. I have looked again and again at my app/build.gradle to make sure release mode is selected. I have cleaned every thing with flutter clean then re-generated the bundel (.app) with no success. Here is a portion of my app/build.gradle file:
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
I am at lost here, any help would be greatly appreciated. I don't know if the issue is related to the previous react-native artifact I have previously uploaded (which by the way, I can't delete from Google Play Console bundles explorer)

Related

While building APK in flutter project

What went wrong:
Execution failed for task ':app:packageRelease'.
A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnable
SigningConfig "release" is missing required property "storeFile"
You can try this
android {
signingConfigs {
release {
storeFile file('your_key_store_path')
storePassword 'your_store_password'
keyAlias = 'your_key_alias'
keyPassword 'your_key_password'
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
I faced the same issue when I was working on a github project, and it was because I was trying to generate a signed apk without the upload-keystore.jks in the android/app/ directory. Also I didn't have the key.properties file in the android/ directory. I solved the issue after asking for the files and setting them in the directories mentioned above.
If you are the owner of the project maybe you should try to follow this steps from the documentation.

Derffered component not splitting apk when signed with release configuration

I have apk of Flutter having size around 700MB (app has local videos, assets). I have uploaded testflight easily as Apple allows 4GB IPA file. Now to handle this issue on Google play console flutter recommend Deferred components
I followed the official documentation but on last step when I run flutter build appbundle
command with signing configuration
buildTypes {
release {
signingConfig signingConfigs.debug
}
}
differed components are separated from base apk , thats good.
but with
buildTypes {
release {
signingConfig signingConfigs.release
}
}
resulting in a deferred library being compiled as part of the base loading unit.
Any help would be appreciated.

how to release flutter app to google play?

I want to release an flutter app for Google play store and I checked every step of in Instruction page of flutter, but every time I got this error:
* What went wrong:Execution failed for task ':app:validateSigningRelease'.> Keystore file not set for signing config release
update: I waw wrong with naming key file :) it was key.propertis an 'e' has been left
You are probably missing the signingConfig for release inside your android/app/build.gradle file. It should look like this:
signingConfigs {
release {
keyAlias 'keyAlias'
keyPassword 'keyPassword'
storeFile file('storeLocation')
storePassword 'storePassword'
}
}
This should be put inside the android section.

You need to sign your APK or Android App Bundle in release mode

I'm trying to upload the flutter app to the google play store, but it won't let me upload the aab file. The error is saying "You uploaded an APK or Android App Bundle that was signed in debug mode. You need to sign your APK or Android App Bundle in release mode. " and I changed my code like below.
So I changed signinConfigs to release, but getting the same error...
Also, one of the tutorials has a bundle file, which includes a release file and aab file. (https://youtu.be/zHtco9_Aw7I). But my file structure is something like below. I'm not sure I'm doing correctly or not...
Also, which file should be added on google play console? I used app.apk but didn't work.
Add
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
to your /android/app/build.gradle.
To do this, you should also have generated a keystore and referenced it in the build.gradle file before, like:
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
You should also read the docs at: https://flutter.dev/docs/deployment/android.
The appbundle is created by using flutter build appbundle, and it is located in \build\app\outputs\bundle\release. You should submit that bundle file to the play store, you can read more about it at Difference between apk (.apk) and app bundle (.aab)

Your Android App Bundle is signed with the wrong key while updating my app in flutter Error

I just dont quite understand why is this happening to me.I followed all the steps as in https://flutter.dev/docs/deployment/android to upload my first version.There was something wrong in it.So I created another (a previous kind of backup project)flutter project and modified it to the existing one.I changed the com.flutterappstareawayvrsn1 which was initially something else.
I have put the key and it still shows the error:
Your Android App Bundle is signed with the wrong key. Ensure that your App Bundle is signed with the correct signing key and try again: :********************
How do you fix this thing?
I figured out what I was doing wrong.As per instructions in https://flutter.dev/docs/deployment/android
Original Code was:
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now,
// so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
The Modified code was to be:
With the signing configuration info:
content_copy
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ?
file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
But I didnt modify buildtypes
{
..
.}
I took it for granted and kept it in debug rather than release