I created a signed APK with Android Studio, and I added to Google Developer console and Facebook console my SHA1 fingerprint and the relative api keys in my app. Everything works well if I upload my signed apk via USB, after installing it maps API and facebook api works well. If I upload the same apk to the Play Store, when I try to login with Facebook, it says "invalid key hash. The key hash blablabla doesn't match with any stored..". So if I log without facebook, I can't even get my google maps; this leads me to think that the apk loaded on the play store changes his fingerprint or some stuff like that. I checked all the stuff on Android Developers and Stackoverflow, but I can't make it work, because the strange thing is that this signed release apk works well until I load it on the Play Store.
I finally solved, the problem was probably that the file google_maps_api.xml provided by the api was not loaded in the release, so i
i did like that:
buildTypes {
debug {
manifestPlaceholders = [mapsKey: "AIzaSyB8o9KzQ5YN8U8AFS************"]
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
manifestPlaceholders = [mapsKey: "AIzaSyApLacqgkdIR7uEpcf*****************"]
}
}
and then in my AndroidManifest
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="${mapsKey}" />
Reference: https://stackoverflow.com/a/33917692/3235560
then i registered 2 different keys each with the right sha1 fingerprint, one debug and the other given by Google Play console (not the upload certificate, but the other one generated by Google).
Very Very thanks to Zuhad and Andy Developer for inspiration.