After uploading app to google play, google phone authentication is not working. Below is the error I am getting in logcat.
This app is not authorized to use Firebase Authentication. Please verify that the correct package name and SHA-1 are configured in the Firebase Console.
Most of the answers I have read on stack-overflow tell that "SHA1 key is different for signed apk. So you have two SHA1, one each for debug and release version. The SHA1 for release version can be obtained from keystore file."
These answers do not solve my problem. Here is what I have done so far.
I have added both debug and release SHA1 keys in google firebase console.
Downloaded the new google-services.json file and replaced in the projected folder with the old one.
Generated the signed apk from android studio.
If I manually install the apk in my phone both debug and release versions of apk work fine.
But if I upload the released version to google play for beta testing it gives me App validation failed error.
I have also confirmed that SHA1 are same in "App signing" in Google Play Console and Firebase Console.
Any help please.
here is build.gradle
plugins {
id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.8.1'
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "-----"
minSdkVersion 15
targetSdkVersion 27
useLibrary 'org.apache.http.legacy'
versionCode 7
versionName "1.0"
multiDexEnabled true
manifestPlaceholders = [onesignal_app_id : "---",
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: "REMOTE"]
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
maven {
url 'http://dl.bintray.com/amulyakhare/maven'
maven { url 'https://dl.bintray.com/alexeydanilov/maven' }
}
maven {
url 'https://raw.githubusercontent.com/felixb/mvn-repo/master/'
}
jcenter()
maven {
url "https://maven.google.com"
}
mavenCentral()
}
}
dependencies {
compile "com.splitwise:tokenautocomplete:2.0.8@aar"
compile 'com.googlecode.libphonenumber:libphonenumber:8.4.2'
compile 'com.viewpagerindicator:viewpagerindicator:2.4.3'
compile 'com.anjlab.android.iab.v3:library:1.0.44'
compile 'com.onesignal:OneSignal:[3.9.1, 3.99.99)'
compile 'com.google.firebase:firebase-auth:15.0.0'
compile 'com.google.android.gms:play-services-safetynet:15.0.0'
compile 'com.android.support:design:27.1.1'
compile 'com.android.support:appcompat-v7:27.1.1'
compile 'com.github.amlcurran.showcaseview:library:5.4.3'
compile 'com.android.support:multidex:1.0.3'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
}
apply plugin: 'com.google.gms.google-services'