我有以下错误
什么文件可以造成冲突?
这是错误
此错误
错误日志无运行
it.unipi.iet.namefirebase V/FA: Inactivity, disconnecting from the service
it.unipi.iet.namefirebase W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
it.unipi.iet.namefirebase W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
com.google.android.gms I/AuthChimeraService: Executing request: ProxyRequest[ url: https://www.googleapis.com/identitytoolkit/v3/relyingparty/signupNewUser?alt=proto&key=AIzaxxxxxxxxxxxxxxxxx, method: 1 ]
com.google.android.gms.persistent W/GLSUser: [DeviceKeyStore] Cannot load key: Device key file not found.
? D/WVCdm: Instantiating CDM.
system_process I/AccountManagerService: getTypesVisibleToCaller: isPermitted? true
? I/WVCdm: CdmEngine::OpenSession
? I/WVCdm: Level3 Library Sep 28 2015 13:08:28
? W/WVCdm: Could not read /data/mediadrm/IDM1013/ay64.dat2: No such file or directory
? W/WVCdm: Could not load liboemcrypto.so. Falling back to L3. dlopen failed: library "liboemcrypto.so" not found
? I/WVCdm: CdmEngine::QueryKeyControlInfo
? W/WVCdm: BufferReader::Read<T> : Failure during parse: Not enough bytes (4)
? W/WVCdm: CdmEngine::ExtractWidevinePssh: Unable to read atom size.
? I/WVCdm: CdmEngine::GenerateKeyRequest
? D/WVCdm: PrepareKeyRequest: nonce=331363162
? I/WVCdm: CdmEngine::CloseSession
? W/Binder_3: type=1400 audit(0.0:36): avc: denied { search } for name="1337" dev="proc" ino=4186 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:zygote:s0 tclass=dir permissive=0
com.google.android.gms.unstable D/EGL_emulation: eglCreateContext: 0xaa3f7da0: maj 2 min 0 rcv 2
com.google.android.gms.unstable D/EGL_emulation: eglMakeCurrent: 0xaa3f7da0: ver 2 0 (tinfo 0xaa13d7d0)
com.google.android.gms.unstable D/EGL_emulation: eglCreateContext: 0xaa3f8dc0: maj 2 min 0 rcv 2
com.google.android.gms.unstable D/EGL_emulation: eglMakeCurrent: 0xaa3f8dc0: ver 2 0 (tinfo 0xaa13d7d0)
? W/Binder_3: type=1400 audit(0.0:37): avc: denied { read } for name="/" dev="tmpfs" ino=2985 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:device:s0 tclass=dir permissive=0
com.google.android.gms.persistent W/Conscrypt: Could not set socket write timeout:
com.google.android.gms.persistent W/Conscrypt: java.lang.reflect.Method.invoke(Native Method)
com.google.android.gms.persistent W/Conscrypt: com.google.android.gms.org.conscrypt.Platform.setSocketWriteTimeout(:com.google.android.gms@11509470:13)
com.google.android.gms.persistent W/Conscrypt: Could not set socket write timeout:
com.google.android.gms.persistent W/Conscrypt: java.lang.reflect.Method.invoke(Native Method)
com.google.android.gms.persistent W/Conscrypt: com.google.android.gms.org.conscrypt.Platform.setSocketWriteTimeout(:com.google.android.gms@11509470:13)
com.google.android.gms.persistent W/GLSUser: [AppCertManager] IOException while requesting key:
java.io.IOException: Invalid device key response.
at ewg.a(:com.google.android.gms@11509470:11)
at ewg.a(:com.google.android.gms@11509470:63)
at ewg.a(:com.google.android.gms@11509470:20)
at ewe.a(:com.google.android.gms@11509470:4)
at ewe.onTransact(:com.google.android.gms@11509470:4)
at android.os.Binder.transact(Binder.java:387)
at buy.onTransact(:com.google.android.gms@11509470:3)
at android.os.Binder.execTransact(Binder.java:453)
com.google.android.gms.persistent W/GLSUser: [DeviceKeyStore] Cannot load key: Device key file not found.
com.google.android.gms W/Conscrypt: Could not set socket write timeout:
com.google.android.gms W/Conscrypt: java.lang.reflect.Method.invoke(Native Method)
com.google.android.gms W/Conscrypt: com.google.android.gms.org.conscrypt.Platform.setSocketWriteTimeout(:com.google.android.gms@11509470:13)
com.google.android.gms W/Conscrypt: Could not set socket write timeout:
com.google.android.gms W/Conscrypt: java.lang.reflect.Method.invoke(Native Method)
com.google.android.gms W/Conscrypt: com.google.android.gms.org.conscrypt.Platform.setSocketWriteTimeout(:com.google.android.gms@11509470:13)
com.google.android.gms E/Volley: [407] BasicNetwork.performRequest: Unexpected response code 400 for https://www.googleapis.com/identitytoolkit/v3/relyingparty/signupNewUser?alt=proto&key=AIzaxxxxxxxxxxxxxxxxxxxxxx
com.google.android.gms I/AuthChimeraService: Error description received from server: OPERATION_NOT_ALLOWED
it.unipi.iet.namefirebase D/MainActivity: signInAnonymously:onComplete:false
it.unipi.iet.namefirebase D/AndroidRuntime: Shutting down VM
it.unipi.iet.namefirebase E/UncaughtException: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.google.firebase.auth.FirebaseUser.getProviderId()' on a null object reference
at it.unipi.iet.namefirebase.MainActivity$4$1.onComplete(MainActivity.java:112)
at com.google.android.gms.tasks.zzc$1.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
it.unipi.iet.namefirebase D/FA: Logging event (FE): _ae, Bundle[{_o=crash, timestamp=1509387653081, fatal=1}]
it.unipi.iet.namefirebase V/FA: Using measurement service
it.unipi.iet.namefirebase V/FA: Connecting to remote service
com.google.android.gms W/FirebaseAuth: [PhoneNumberAuthPostProcessor] postProcess starts
com.google.android.gms W/FirebaseAuth: [PhoneNumberAuthPostProcessor] postProcess ends
it.unipi.iet.namefirebase E/AndroidRuntime: FATAL EXCEPTION: main
Process: it.unipi.iet.namefirebase, PID: 3983
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.google.firebase.auth.FirebaseUser.getProviderId()' on a null object reference
at it.unipi.iet.namefirebase.MainActivity$4$1.onComplete(MainActivity.java:112)
at com.google.android.gms.tasks.zzc$1.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
system_process W/ActivityManager: Force finishing activity it.unipi.iet.namefirebase/.MainActivity
? D/gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 1806336
it.unipi.iet.namefirebase I/FirebaseCrash: Sending crashes
[ 10-30 18:20:53.326 1771: 2105 D/ ]
HostConnection::get() New Host Connection established 0x9d2fe140, tid 2105
[ 10-30 18:20:53.341 1771: 2105 W/ ]
Unrecognized GLES max version string in extensions: ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_dma_v1
? E/EGL_emulation: tid 1207: eglCreateSyncKHR(1881): error 0x3004 (EGL_BAD_ATTRIBUTE)
? W/audio_hw_generic: Not supplying enough data to HAL, expected position 462294 , only wrote 461378
? W/audio_hw_generic: Not supplying enough data to HAL, expected position 461380 , only wrote 461378
? W/audio_hw_generic: Not supplying enough data to HAL, expected position 462078 , only wrote 462039
system_process I/AccountManagerService: getTypesVisibleToCaller: isPermitted? true
system_process I/OpenGLRenderer: Initialized EGL, version 1.4
system_process D/EGL_emulation: eglCreateContext: 0x9f70ede0: maj 2 min 0 rcv 2
system_process D/EGL_emulation: eglMakeCurrent: 0x9f70ede0: ver 2 0 (tinfo 0x9df77ab0)
system_process D/EGL_emulation: eglMakeCurrent: 0x9f70ede0: ver 2 0 (tinfo 0x9df77ab0)
it.unipi.iet.namefirebase I/FirebaseCrash: Response code: 200
it.unipi.iet.namefirebase I/FirebaseCrash: Report sent with crash report id: b8d1495fb4000000
}
代码主要活动
package it.unipi.iet.namefirebase;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import iit.unipi.iet.namefirebase.utilities.AuthUtilities;
import it.unipi.iet.namefirebase.utilities.DatabaseUtilities;
import com.facebook.AccessToken;
import com.facebook.CallbackManager;
import com.facebook.FacebookCallback;
import com.facebook.FacebookException;
import com.facebook.FacebookSdk;
import com.facebook.login.LoginResult;
import com.facebook.login.widget.LoginButton;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthCredential;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FacebookAuthProvider;
import com.google.firebase.auth.FirebaseUser;
public class MainActivity extends Activity{
public static final String SIGN = "it.unipi.iet.namefirebase.SIGN";
private final String TAG = "MainActivity";
private AuthUtilities AuthUt;
private CallbackManager callbackManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FacebookSdk.sdkInitialize(getApplicationContext());
callbackManager = CallbackManager.Factory.create();
setContentView(R.layout.activity_main);
// Check Authentication
AuthUt = new AuthUtilities();
if(AuthUt.getUser() != null ){
// if user is already logged changes activity
Log.d(TAG,"User already logged");
Intent i = new Intent(MainActivity.this,MapsActivity.class);
startActivity(i);}
else{
Log.d(TAG,"User not logged yet");
}
// Sign in Button
final Button SignIn = (Button) findViewById(R.id.button);
SignIn.setOnClickListener(new View.OnClickListener(){
public void onClick(View v){
Intent intent = new Intent(MainActivity.this,LoginActivity.class);
intent.putExtra(SIGN,"sign-in");
startActivity(intent);
}
});
// Sign up with email Button
final Button SignUp = (Button) findViewById(R.id.button2);
SignUp.setOnClickListener(new View.OnClickListener(){
public void onClick(View v){
Intent intent = new Intent(MainActivity.this,LoginActivity.class);
intent.putExtra(SIGN,"sign-up");
startActivity(intent);
}
});
// Connect with Facebook button
FacebookSdk.sdkInitialize(getApplicationContext());
callbackManager = CallbackManager.Factory.create();
LoginButton loginButton = (LoginButton) findViewById(R.id.button3);
loginButton.setReadPermissions("email", "public_profile");
loginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
Log.d(TAG, "facebook:onSuccess:" + loginResult);
handleFacebookAccessToken(loginResult.getAccessToken());
}
@Override
public void onCancel() {
Log.d(TAG, "facebook:onCancel");
// ...
}
@Override
public void onError(FacebookException error) {
Log.d(TAG, "facebook:onError", error);
// ...
}
});
// Browse as a guest button
final Button GuestUser = (Button) findViewById(R.id.button4);
GuestUser.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// signin_anonymously
AuthUt.get_mAuth().signInAnonymously()
.addOnCompleteListener(MainActivity.this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
Log.d(TAG, "signInAnonymously:onComplete:" + task.isSuccessful());
Log.d(TAG,"User Provider: "+ AuthUt.get_mAuth().getCurrentUser().getProviderId());
// start MapsActivity
Intent i = new Intent(MainActivity.this,MapsActivity.class);
startActivity(i);
// If sign in fails, display a message to the user. If sign in succeeds
// the auth state listener will be notified and logic to handle the
// signed in user can be handled in the listener.
if (!task.isSuccessful()) {
Log.w(TAG, "signInAnonymously", task.getException());
Toast.makeText(MainActivity.this, "Authentication failed.",
Toast.LENGTH_SHORT).show();
}
}
});
}
});
}
@Override
public void onStart() {
super.onStart();
AuthUt.addListner();
}
@Override
public void onStop() {
super.onStop();
AuthUt.removeListener();
}
/*
* Disable going back function
*/
@Override
public void onBackPressed() {
// disable going back to the previous Activity
moveTaskToBack(true);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
callbackManager.onActivityResult(requestCode, resultCode, data);
}
private void handleFacebookAccessToken(AccessToken token) {
Log.d(TAG, "handleFacebookAccessToken:" + token);
AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
AuthUt.get_mAuth().signInWithCredential(credential)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
Log.d(TAG, "signInWithCredential:onComplete:" + task.isSuccessful());
FirebaseUser user = AuthUt.get_mAuth().getCurrentUser();
Log.d(TAG,"url "+user.getPhotoUrl());
DatabaseUtilities db = new DatabaseUtilities();
db.writeNewUser(user.getUid(),user.getDisplayName(),null,user.getPhotoUrl().toString(),null, null);
Log.d(TAG,"Fb user created");
// start MapsActivity
Intent i = new Intent(MainActivity.this,MapsActivity.class);
startActivity(i);
// If sign in fails, display a message to the user. If sign in succeeds
// the auth state listener will be notified and logic to handle the
// signed in user can be handled in the listener.
if (!task.isSuccessful()) {
Log.w(TAG, "signInWithCredential", task.getException());
Toast.makeText(MainActivity.this, "Authentication failed.",
Toast.LENGTH_SHORT).show();
}
}
});
}
}