Flutter Android Release Build Results in ApiException 10 - android

I've pushed an Alpha version of my app up to the PlayStore, but as soon as I try to authenticate within the app I get the "ApiException 10" which usually means that my signing configuration is incorrect. However, I've triple checked all of those configs and I can't find anything wrong. This is what is in my build.gradle file:
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
Those keystoreProperties point to a jks file and I've verified that the alias, password, etc. are all correct. I've also checked in the Firebase console and the SHA1 fingerprint of the key is in there.
It does work fine if I run it locally in debug mode, but as soon as I build a release that I push up to the PlayStore, it fails. I'm not quite sure what else to check, so any help here would be greatly appreciated!

make sure u have update your release sha in firebase as well as fill form of your application on google console mostly ApiException 10 becuase of wrong sha so please have look, as well as credentials set up in console as well.

Related

Your Android App Bundle is signed with the wrong key. Unable to upload to play Store

I recently switched my app to flutter which was previously pure java based and the app had previous presence in play store where Google was managing it's app signing key.
Now when I tried to generate bundle using same old .jks key through flutter and tried to upload to play store, I get following 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. Your App Bundle is expected to be signed with the certificate with fingerprint:
SHA1: 98:42:A0:2B:8F:A7:1A:42:A1:5D:E3:8D:45:92:3D:E7:9A:D1:84:8A
but the certificate used to sign the App Bundle you uploaded has fingerprint:
SHA1: 16:73:6C:3D:DC:89:BB:7B:1C:E7:17:DA:0C:7C:9F:B0:2F:76:F8:89
local.properties:
sdk.dir=C:\\Users\\decen\\AppData\\Local\\Android\\sdk
ndk.dir=C:\\Users\\decen\\AppData\\Local\\Android\\sdk\\ndk\\24.0.7956693
flutter.sdk=C:\\src\\flutter
flutter.buildMode=release
flutter.versionName=7.4.5
flutter.versionCode=145
key.properties
storePassword=Password
keyPassword=Password
keyAlias=key
storeFile=D:\\AndroidStudioKeys\\appName\\key.jks
app/build.gradle:
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
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
signingConfig signingConfigs.release
minifyEnabled true
shrinkResources true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
Now, I can't manage to delete my existing project from Play store and start from scratch. Please help.
Thanks in advance.

How come when I generate a signed APK it produces out a JKS file?

I'm using the newest version of Android Studio and I am looking at publishing an app on the Play store. Unfortunately when I generate a signed APK it only gives me the open to produce a JKS file. All the tutorials I've seen makes it look like you put an APK and that's what you get out, but those are using older versions of Android studio. Do I need to put the JKS file through something else, download an older version of Android Studio or am I missing a step? I'm really new at this and I'd appreciate any help I can get. Thanks!
You need to create a JKS file once. After that make sure You have something like this in Your gradle file, inside "android" part:
signingConfigs {
config {
keyAlias 'key'
keyPassword '123456'
storeFile file('../app/key/yourAppKey.jks')
storePassword '123456'
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
}
After this part has been added just set build variant -> release and then use build -> build bundle/apk -> build apk

admob ads are not working in signed apk,it worked perfect at debug version

admob ads are not working in signed apk,it worked perfect at debug version.
in my first version of apk i shared my debug version in android with ads,now my app have more than 200 users,so i decided to publish it on play store but after i signed apk , admob is not working......
Why does the signed apk not showing ads?
Is it possible to publish apps in debug mode?
i tried to close verify the passwords but it has no use
Are you using ProGuard when signing your apk/bundle? If that is the case the following rules worked for me:
-keep class com.google.android.gms.common.GooglePlayServicesUtil {*;}
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient {*;}
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info {*;}
If you are not using ProGuard make sure you are not using the test ad unit IDs. Other than that you should check whether you have setup your Ad Unit IDs properly from the AdMob dashboard and see whether requests are coming in. Additionally, you can check whether the callbacks inside your app are returning an error code 3 with message No fill. If that is the case - this is totally expected behaviour, since you cannot expect to have a 100% fill rate all the time.
Also, Add release build configuration in build-gradle (app level) file.
signingConfigs {
release {
storeFile file('keystore_file_path_stored_in_your_computer')
storePassword 'add_your_keystore_password'
keyAlias = 'your_key_alias'
keyPassword 'your_password'
if (project.hasProperty("RELEASE_STORE_FILE")) {
storeFile file(RELEASE_STORE_FILE)
storePassword RELEASE_STORE_PASSWORD
keyAlias RELEASE_KEY_ALIAS
keyPassword RELEASE_KEY_PASSWORD
}
}
}
buildTypes {
release {
debuggable false
jniDebuggable false
renderscriptDebuggable false
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
zipAlignEnabled = false
multiDexEnabled = false
if (project.hasProperty("RELEASE_STORE_FILE")) {
signingConfig signingConfigs.release
}
}
}
If none of the other ways to fix it works, then do the following. Check your keystore.jks file to make sure it is configured properly to your current project in your build.gradle(app) file, as well as when you build the signed apk or bundle. My keystore.jks files did not match but when I changed it, it worked exactly how it is supposed to function.
It worked for emulators and debug apk before I changed/ fix the issue. None of the other ways described worked for me.

How to sign debug APK's with the same key as release APK's - Android Studio

I want to test in-app purchasing within my app, but it seems impossible to do this with a regular debug APK through Android Studio? Has anyone done this before and if so what steps did you take to do it?
I was thinking to get around it I should try signing my debug APK's in the same way I sign my release APK's. How can I do this?
You can config that in your android studio, right click your project, chose the open module settings
Or if you are crazy about the hand-writen build scripts, here is a snapshot of code:
android {
signingConfigs {
release {
storeFile file(project.property("MyProject.signing") + ".keystore")
storePassword "${storePassword}"
keyAlias "${keyAlias}"
keyPassword "${keyPassword}"
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
debug {
signingConfig signingConfigs.release
}
}
}
Just config your debug and release build type with same signingConfig.

How can I sign testing apk in Android Studio?

I am developing an app in such an android device that requires each app to be signed with a specific key, even the testing apk.
I know how to sign an app by configuring build.gradle. But signing testing app (Instrumentation test) seems no such configing, am I missing something ?
try this in build.gradle
signingConfigs {
release {
keyPassword 'your pw'
storeFile file('your keystore file path')
storePassword 'your pw'
keyAlias 'your alias'
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
debug {
minifyEnabled false
signingConfig signingConfigs.release
}
}
Thanks for NateZh and TWL.
Yes, the answer is to add flowing lines to build.gradle:
signingConfigs {
debug {
keyPassword 'your pw'
storeFile file('your keystore file path')
storePassword 'your pw'
keyAlias 'your alias'
}
}
But, there are more to be take care of:
When using signingConfigs.debug, this tells gradle it's debug key, no need to specific buildTypes.debug.signingConfig again
SigingConfigs.debug also take effect when building instrumentation test
In multi-modules project, if you want to test a module, you should include signingConfigs.debug in the module's build.gradle.
For example, my project looks like:
app
-build.gradle
libs
-src/androidTest/java/com/my/MyTest.java
-build.gradle
Adding signingConfigs.debug to app has no effect when I want to run libs' AndroidDebugTest. Instead, adding signingConfigs.debug to libs' build.gradle do the work.
Hope it's helpful to others.

Categories

Resources