Play商店中的已发布应用无法与Google Maps API和Facebook API进行通信 [英] Published App on Play Store can't communicate with Google Maps API and Facebook API

查看:235
本文介绍了Play商店中的已发布应用无法与Google Maps API和Facebook API进行通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Android Studio创建了一个已签名的APK,并且我在我的应用中添加了Google Developer Console和Facebook控制台中的SHA1指纹和相关api键。一切正常,如果我通过USB上传我的签名apk后,安装地图API和Facebook API后效果很好。如果我将相同的apk上传到Play商店,那么当我尝试使用Facebook登录时,它会显示无效的密钥哈希。密钥哈希blablabla与任何存储的不匹配。。
因此,如果我没有脸书登录,我甚至不能得到我的谷歌地图;这导致我认为在游戏商店中加载的apk更改了他的指纹或类似的东西。
我检查了Android开发人员和Stackoverflow上的所有内容,但是我无法使其工作,因为这个签名版本的apk很好用,直到我将其加载到Play商店中为止。

$ $ b

解决方案

我终于解决了,问题可能是由api提供的文件google_maps_api.xml未在发布中加载,所以我



然后我注册了两个不同的密钥,每个密钥都带有正确的sha1指纹,一个调试,另一个由Google Play控制台提供(不是上传证书,而是另一个由Google生成)。



非常感谢Zuhad和Andy Developer的灵感。


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 strage 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.

这篇关于Play商店中的已发布应用无法与Google Maps API和Facebook API进行通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆