Skip to content Skip to sidebar Skip to footer

Googleapiclient Connection Failed With Statuscode Sign_in_required

I'm trying to connect my game to Google paly service but it keep telling me connection failed with statusCode SIGN_IN_REQUIRED . logcat message: I/GooglePlayServicesActiv﹕ Google

Solution 1:

There is one additional and very important step that beginners like me often overlook in Android studio.

You manually need to specify the Keystore which is used to build and sign the APK when you run it via Android studio. This should be the same Keystore whose SHA1 certificate signature you have entered for generating API key in Google Developer Console.

Here is how you do it:

  1. If you don't have an existing Keystore OR cannot find it, you can create one by going to BUILD -> Generate Signed APK -> Create newKeystore Android Studio

  2. After you have created the Keystore, you need to add it to your Project settings so that it is used to sign the APK. Goto File -> Project Structure -> Select your module (e.g: app) -> SigningKeystore Android Studio

  3. Then you need to specify the Signing Config that you created in Step 2, to Build TypesKeystore Android Studio

Hope this helps someone!

Solution 2:

That solution wasn't seen on any document, for a beginner like me it needed to be mentioned,

Adding the missing permission :

<uses-permissionandroid:name="android.permission.GET_ACCOUNTS" />

to become :

<?xml version="1.0" encoding="utf-8"?><manifestxmlns:android="http://schemas.android.com/apk/res/android"package="com.alnassre.ffeather.android"android:versionCode="1"android:versionName="1.0" ><uses-sdkandroid:minSdkVersion="9"android:targetSdkVersion="22" /><uses-permissionandroid:name="android.permission.INTERNET" /><uses-permissionandroid:name="android.permission.ACCESS_NETWORK_STATE" /><uses-permissionandroid:name="android.permission.GET_ACCOUNTS" /><applicationandroid:allowBackup="true"android:icon="@drawable/ic_launcher"android:label="@string/app_name"android:theme="@style/GdxTheme" ><activityandroid:name="com.alnassre.ffeather.android.AndroidLauncher"android:label="@string/app_name"android:screenOrientation="portrait"android:configChanges="keyboard|keyboardHidden|orientation|screenSize"><intent-filter><actionandroid:name="android.intent.action.MAIN" /><categoryandroid:name="android.intent.category.LAUNCHER" /></intent-filter></activity><meta-dataandroid:name="com.google.android.gms.games.APP_ID"android:value="@string/app_id" /><meta-dataandroid:name="com.google.android.gms.appstate.APP_ID"android:value="@string/app_id" /><meta-dataandroid:name="com.google.android.gms.version"android:value="@integer/google_play_services_version"/></application></manifest>

Solution 3:

An easy solution is to simply create a test OAuth client ID using Android's debug keystore SHA-1.

Go to the API Console -> Credentials -> Create Credentials -> OAuth client ID -> Android

Get Debug SHA-1

C:\Program Files\Android\Android Studio\jre\bin

keytool -exportcert -list -v -alias androiddebugkey -keystore %USERPROFILE%\.android\debug.keystore

Password

android

Enter SHA-1 -> Enter App Package Name -> Create

By default Android studio uses this keystore to sign the debug APK so it should work right away.

Post a Comment for "Googleapiclient Connection Failed With Statuscode Sign_in_required"