我的android应用程序有谷歌登录崩溃。它以电子邮件和密码作为输入,之后每次都会崩溃。
我正在用谷歌登录制作一个应用程序,但输入密码后它崩溃了。我不能理解这个错误参数 E/eglCodecCommon:glUtilsParamSize:未知参数0x000082da E/eglCodecCommon:glUtilsParamSize:未知参数0x000082da 我得到了一个致命的例外 E/AndroidRuntime: 致命异常:主进程:com.abc.project,PID:7050 Java.lang.RuntimeException:未能将结果ResultInfo{who=null,request=9001,result=-1,data=Intent{(有附加项)}}传递到活动{com.abc.project/com.abc.project.GoogleSignInActivity}:Java.lang.NullPointerException java文件:我的android应用程序有谷歌登录崩溃。它以电子邮件和密码作为输入,之后每次都会崩溃。,android,google-signin,Android,Google Signin,我正在用谷歌登录制作一个应用程序,但输入密码后它崩溃了。我不能理解这个错误参数 E/eglCodecCommon:glUtilsParamSize:未知参数0x000082da E/eglCodecCommon:glUtilsParamSize:未知参数0x000082da 我得到了一个致命的例外 E/AndroidRuntime: 致命异常:主进程:com.abc.project,PID:7050 Java.lang.RuntimeException:未能将结果ResultInfo{who=n
package com.abc.project;
import:
import android.app.Activity;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.google.android.gms.auth.api.Auth;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
import com.google.android.gms.auth.api.signin.GoogleSignInResult;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.ResultCallback;
import com.google.android.gms.common.api.Status;
import java.util.Objects;
public class GoogleSignInActivity extends AppCompatActivity implements View.OnClickListener,GoogleApiClient.OnConnectionFailedListener {
private TextView Email;
private TextView Name;
private GoogleApiClient googleApiClient;
private ImageView Prof_Pic;
private static final int REQ_CODE = 9001;
on create:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_google_sign_in);
findViewById(R.id.prof_section).setVisibility(View.GONE);
findViewById(R.id.bn_logout).setOnClickListener(this);
findViewById(R.id.bn_login).setOnClickListener(this);
Name =findViewById(R.id.name);
Email = findViewById(R.id.email);
Prof_Pic = findViewById(R.id.prof_pic);
GoogleSignInOptions signInOptions = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN).requestEmail().build();
googleApiClient = new GoogleApiClient.Builder(this).enableAutoManage(this, this).addApi(Auth.GOOGLE_SIGN_IN_API, signInOptions).build();
}
onclick:
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.bn_login:
signIn();
break;
case R.id.bn_logout:
signOut();
break;
}
}
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
}
onsignin:
private void signIn() {
Intent intent = Auth.GoogleSignInApi.getSignInIntent(googleApiClient);
startActivityForResult(intent, REQ_CODE);
}
on signout:
private void signOut() {
Auth.GoogleSignInApi.signOut(googleApiClient).setResultCallback(new ResultCallback<Status>() {
@Override
public void onResult(@NonNull Status status) {
updateUI(false);
}
});
}
if google sign in is successful:
private void handleResult(GoogleSignInResult result) {
if (result.isSuccess()) {
GoogleSignInAccount account = result.getSignInAccount();
assert account != null;
String name = account.getDisplayName();//get name
String email = account.getEmail();//get email
String img_url = Objects.requireNonNull(account.getPhotoUrl()).toString();//get pic
Name.setText(name);//set name
Email.setText(email);//set email
Glide.with(this).load(img_url).into(Prof_Pic);
updateUI(true);
} else {
updateUI(false);
}
}
User interface update:
private void updateUI(boolean isLogin) {
if (isLogin) {
findViewById(R.id.prof_section).setVisibility(View.VISIBLE);
findViewById(R.id.bn_login).setVisibility(View.GONE);
} else {
findViewById(R.id.prof_section).setVisibility(View.GONE);
findViewById(R.id.bn_login).setVisibility(View.VISIBLE);
}
}
I'am getting an error here:
@Override
protected void onActivityResult(int requestCode, int resultCode ,Intent data){
super.onActivityResult(requestCode, resultCode, data);
//I hope this is correct
if(requestCode== REQ_CODE )
{
GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
handleResult(result);
}
}
}
不要忽略此错误:
E/eglCodecCommon: glUtilsParamSize: unknow param 0x000082da
//无法理解此错误参数
E/eglCodecCommon: glUtilsParamSize: unknow param 0x000082da
D/EGL_emulation: eglMakeCurrent: 0xe9185fa0: ver 3 1 (tinfo 0xf109ba50)
D/EGL_emulation: eglMakeCurrent: 0xe9185fa0: ver 3 1 (tinfo 0xf109ba50)
D/EGL_emulation: eglMakeCurrent: 0xe9185fa0: ver 3 1 (tinfo 0xf109ba50)
D/EGL_emulation: eglMakeCurrent: 0xe9185fa0: ver 3 1 (tinfo 0xf109ba50)
D/EGL_emulation: eglMakeCurrent: 0xe9185fa0: ver 3 1 (tinfo 0xf109ba50)
D/AutoManageHelper: onStart true {0=com.google.android.gms.common.api.internal.zzi$zza@38ae9f9}
D/EGL_emulation: eglMakeCurrent: 0xe9185fa0: ver 3 1 (tinfo 0xf109ba50)
D/EGL_emulation: eglMakeCurrent: 0xe9185fa0: ver 3 1 (tinfo 0xf109ba50)
D/EGL_emulation: eglMakeCurrent: 0xe9185fa0: ver 3 1 (tinfo 0xf109ba50)
D/AutoManageHelper: onStart true {0=com.google.android.gms.common.api.internal.zzi$zza@38ae9f9}
D/EGL_emulation: eglMakeCurrent: 0xe9185fa0: ver 3 1 (tinfo 0xf109ba50)
D/EGL_emulation: eglMakeCurrent: 0xe9185fa0: ver 3 1 (tinfo 0xf109ba50)
此处的致命异常:
D/AndroidRuntime: Shutting down VM
where is the null pointer exception:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.abc.project, PID: 7050
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=9001, result=-1, data=Intent { (has extras) }} to activity {com.abc.project/com.abc.project.GoogleSignInActivity}: java.lang.NullPointerException
at android.app.ActivityThread.deliverResults(ActivityThread.java:4268)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4312)
at android.app.ActivityThread.-wrap19(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1644)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.NullPointerException
at java.util.Objects.requireNonNull(Objects.java:203)
at com.abc.project.GoogleSignInActivity.handleResult
(GoogleSignInActivity.java:90)
at com.abc.project.GoogleSignInActivity.onActivityResult(GoogleSignInActivity.java:117)
at android.app.Activity.dispatchActivityResult(Activity.java:7276)
at android.app.ActivityThread.deliverResults(ActivityThread.java:4264)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4312)
at android.app.ActivityThread.-wrap19(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1644)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
account.getPhotoUrl()
为空。@漫游者如何?检索到的帐户可能没有照片集。你不应该断言它不是空的。
D/AndroidRuntime: Shutting down VM
where is the null pointer exception:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.abc.project, PID: 7050
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=9001, result=-1, data=Intent { (has extras) }} to activity {com.abc.project/com.abc.project.GoogleSignInActivity}: java.lang.NullPointerException
at android.app.ActivityThread.deliverResults(ActivityThread.java:4268)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4312)
at android.app.ActivityThread.-wrap19(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1644)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.NullPointerException
at java.util.Objects.requireNonNull(Objects.java:203)
at com.abc.project.GoogleSignInActivity.handleResult
(GoogleSignInActivity.java:90)
at com.abc.project.GoogleSignInActivity.onActivityResult(GoogleSignInActivity.java:117)
at android.app.Activity.dispatchActivityResult(Activity.java:7276)
at android.app.ActivityThread.deliverResults(ActivityThread.java:4264)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4312)
at android.app.ActivityThread.-wrap19(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1644)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)