“An internal error occurred” with integration of G

2019-01-03 09:43发布

I am trying to integrate a Google plus Login in my application as per the instruction provided by following link : https://developers.google.com/+/quickstart/android#install-sdk

I am following all the instructions perfectly. And when I run the sample application on a real device provided in the android-sdk and click the signin button, it display a Toast message that An internal error occurred

What am I doing wrong?

20条回答
做自己的国王
2楼-- · 2019-01-03 10:12

Something often overlooked is the package name. I'd like to clarify the step 6 by Eric Leschinski above (can't comment there): the required package is not the package of an activity, rather the package of your app's manifest.

You may retrieve the correct value from the root element of AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.ntk.darkmoor"
    android:versionCode="1"
    android:versionName="1.0" >

In this example define "com.ntk.darkmoor" while creating the Client ID

查看更多
兄弟一词,经得起流年.
3楼-- · 2019-01-03 10:14

I've solved problem by removing .setScopes("PLUS_LOGIN") in the PlusClient.Builder.

查看更多
beautiful°
4楼-- · 2019-01-03 10:16

For me it was that i was attempting to use my production key when installing it using my debug key. Make sure your using the right SHA1 from the right keystore.

查看更多
倾城 Initia
5楼-- · 2019-01-03 10:17

I turned around to the Google IO 2013, and changed the initialization of PlusClient, then it works.

public static final String AUTH_SCOPES[] = {
    Scopes.PLUS_LOGIN,
    "https://www.googleapis.com/auth/userinfo.email",
    "https://www.googleapis.com/auth/developerssite" };

mPlusClient = new PlusClient.Builder(this, this, this)
    .setScopes(AUTH_SCOPES)
    .build();
查看更多
萌系小妹纸
6楼-- · 2019-01-03 10:17

I had the same issue when I used SHA1 for debug.keystore for debuging then exported my application forgetting to generate SHA1 for keystore that I used to export my application.

查看更多
劫难
7楼-- · 2019-01-03 10:19

I have been searching how to fix this for a day with full of research without luck finally i managed to resolve this issue with the following approach.

Before i begin resolving this (at least how ti worked for me) i have to say that everything on the documentation is correct and you don't have to change any lines of code or so. It looks like more of a bug in the https://cloud.google.com/console cloud console

First ensure you got the correct SHA1 and your project's package name as described in the docs https://developers.google.com/+/quickstart/android

Now this bug as i noticed (at least for me) was that in my cloud console, the project i have created was long ago with the old interface and few months ago i migrated to the new GUI.Once you get the new look on cloud console you will notice that new projects have an auto generated project id like this atlantean-ares-331 while old projects got a long integer value as project id which is not visible. So if your project was created with the old GUI and you have just created new client id for OAuth for that project you will get the Toast "An internal error occurred” while trying to sign in with google.

How to Fix

  1. Go to your cloud console
  2. Make a new project i would suggest a name like oldprojectname-gplus
  3. In APIs section enable Google+ API
  4. Ensure that none of your projects has the same package name on OAuth Client ID with the one you will use now otherwise you will get Error This client ID is globally unique and is already in use.(you will have to delete the old OAuth client id with the same package name you will use now).

  5. Go to Credentials Create New Client ID for OAuth.

Installed application

Android

Enter your project's package name and your SHA1

Done

查看更多
登录 后发表回答