Android Google Sign In 在用户登录时会闪现一个小的空白白框。

38

基本上,当用户按下登录按钮并在Google完成登录过程之前,Android谷歌登录会闪烁一个小的空白白框。这一切发生得非常快,但我想摆脱这个白框。我认为这个白框是显示进度条的失败尝试。

编辑:添加了一个图形重现正在发生的事情...

Representation

我正在三星Tab 3上测试。

此问题不包括用户第一次登录或访问权限被吊销后登录的情况。

  GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
      .requestEmail()
      .requestIdToken(getString(R.string.google_server_client_id))
      .build();

  // google login stuff
  googlebutton = (com.google.android.gms.common.SignInButton) findViewById(R.id.googlebutton);
  googlebutton.setOnClickListener(this);
  googlebutton.setStyle(SignInButton.SIZE_STANDARD, SignInButton.COLOR_LIGHT);
  // Build GoogleApiClient with access to basic profile
  mGoogleApiClient = new GoogleApiClient.Builder(this)
      .enableAutoManage(this /* FragmentActivity */, this /* OnConnectionFailedListener */)
      .addApi(Auth.GOOGLE_SIGN_IN_API, gso)
      .build();

并且登录功能...

private void gSignIn() {
  Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
  startActivityForResult(signInIntent, RC_SIGN_IN);
}
理想情况下,我希望恢复正常的进度条行为。
这是我的Gradle...
apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion '23.0.0'

    defaultConfig {
        applicationId "xxxxxxxxx"
        minSdkVersion 17
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.google.android.gms:play-services-identity:8.4.0'
    compile 'com.google.android.gms:play-services-plus:8.4.0'
    compile 'com.google.android.gms:play-services-auth:8.4.0'
    //compile 'com.google.android.gms:play-services:8.4.0'
    compile 'com.facebook.android:facebook-android-sdk:4.1.0'
    compile 'com.android.support:design:23.0.1'
}

1
你能否有机会发布一张它运行时的图片吗? - DarthCaniac
1
这发生得太快了,我来不及截屏。这个框大约和两个单词的句子一样大。它实际上只是一个小白框,不是像素大小的微小,而是单词大小的微小。 - deanresin
2
最近的应用程序中,有人找到了解决此问题的方法吗?我已经遇到这个问题超过五个月了。 - EngineSense
1
你是否添加了正确的SHA1密钥,并且是否从添加SHA1密钥的同一台机器编译了此版本? - Shubham Jain
1
您正在使用较旧的gms版本,请尝试更新到最新版本。 - Amedeo Baragiola
显示剩余7条评论
3个回答

1
尝试这个,不确定: 这只是您在清单中为该活动应用的标签,从该活动中删除它。
android:label="@string/app_name"

或者检查您的布局文件中是否存在一些空视图,这些视图正在显示。

谢谢。

0

我猜你在XML中使用了Button视图,然后将其转换为com.google...SignInButton,因为它的空框会显示一段时间。尝试将XML视图更改为com.google...SignInButton


0

我认为你还没有在依赖部分之外添加

apply plugin: 'com.google.gms.google-services'

同时在项目级别的gradle文件中添加classpath

classpath 'com.google.gms:google-services:3.1.1'

更新Google Play服务、Android平台工具和Android构建工具。 有时这是由于版本冲突引起的。 尝试一下,但我不确定是否有效。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接