问题
I link this 2 log in api with my app and it is already done in debug mode(connect my phone with my computer and press run). When I build apk and put it to my phone and run , it doesn't work like in debug mode.
It alerts that 1. windows excption index out of bound 2. hash key doesn't match (google result error code: 10)
I think the first problem isn't the true problem. I think the second is the problem so I go to see the SHA-1 on my computer. It's a match with SHA-1 in developergoogle.
I run app in debug mode.
It works well. The result of google api is error code:0 (not error)
Can anyone tell me what this problem is and how to solve it ?
回答1:
Here is the answer for why you can't see the Google Map.
I recently Upload the APK on Google Play store and I faced the same issue after checking the Play Console I found the solution for this problem.
Their is no problem with your key but the problem is with your SHA-1. You signed your APK with your SHA-1 that is fine and then upload the APK it also fine.
But as per the new update for Play Console when you signed your APK with SHA-1 and upload the APK it only signed by you but as per the new update it is also signed by Google Play for more security. Have a look here some part of Google Play section:
With Google Play App Signing: You sign your app with your upload key. Then, Google verifies and removes the upload key signature. Finally, Google re-signs the app with the original app signing key you provided and delivers your app to the user.
You can refer Documentation here.
Now, The Answer of your question is After successfully upload the APK you can see that in the section with Two SHA-1 the 1st SHA-1 is Google created its own and 2nd SHA-1 is its yours.
So just copy the Google SHA-1 and paste it to your console where you generate the Google Map API Key.
How to create a keystore? You can refer this.
来源:https://stackoverflow.com/questions/45055827/androidgoogle-login-api-and-facebook-log-in-api-cannot-use-in-app-apk