Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Release signed Android App,Google Plus Login and Google Map not Working

1.I am using Google plus login and Google map in my android Application.

2.In while debugging the App from Android Studio to Real device(Mobile)Google plus login and Google Map Works Fine.(Everything Works fine)

Problem:

1.Build--> Generate Signed APK -from android Studio ,i made Release apk its not able to login using Google plus.

2.Also Google Map is showing empty screen.

I tried to create OAuth Client ID, its Giving Error message from Google Developer Console

Error Message: Duplicate fingerprint The fingerprint you specified is already used by an Android OAuth2 client ID in this project or another project

Link i reffered for Google plus Login

Please help me anyone how to resolve it.

EDIT :1

1.I tested debug.apk its worked perfectly Google plus login and map.

2.But not working in release.apk.help me how to solve it.

like image 513
Kumar Avatar asked Nov 20 '15 07:11

Kumar


2 Answers

You have generate Sign keyHash like this .

keytool -exportcert -alias androiddebugkey -keystore %HOMEPATH%\.android\debug.keystore | openssl sha1 -binary | openssl
base64

For Example Like this

C:\Program Files\Java\jdk1.6.0_22\bin\keytool.exe" -exportcert -alias selvin -keystore c:\users\selvin\desktop\selvin.kp | C:\OpenSSL-Win32\bin\openssl sha1 -binary | C:\OpenSSL-Win32\bin\openssl base64

this is generate for CMD in your system add add this Hash key in your Google consol.

like image 156
Abhinav singh Avatar answered Oct 14 '22 08:10

Abhinav singh


If you haven't yet added the release SHA1 to the firebase console or developer console, please do it first and make sure you add the google-services.json downloaded from the console to the root of the project folder as given in the previous answers. If the issue still persists even after doing this, please add the following line to the proguard-rules.pro of your project.

-keep class <package-name>.** {*;}

Note: This method may increase the size of your app-release.apk, but the oauth login will work for sure. To reduce the size, be particular about the class that you specify in the proguard. For example,

-keep class <package-name>.<class-name> {*;}

The class name can be found if you know which class the proguard compresses such that the class is not executed. In this case, it is the login oauth that may have been prevented by the proguard from being executed. So, add that class along with any other pojo classes associated with the login in the proguard as shown below:

-keep class <package-name>.<class-name> {*;}

-keep class <package-name>.<pojo-class> {*;} (if any)

Add all the classes associated with the login as shown and you will be good to go.

like image 34
Aakash Venkat Avatar answered Oct 14 '22 06:10

Aakash Venkat