後,Firebase Android無法在此bug中輸入addOnCompleteListener 2天后,我必須發佈此問題,我正在創建一個數據庫,因爲它出現在我的cadastrarUsuario方法中。問題是,在傳遞「createUserWithEmalandPassword」行並在firebaseAuthentication中創建用戶(我在瀏覽器中檢查過)之後,它只是崩潰。控制檯說:在創建用戶
05-05 06:36:48.895 4791-4834/studio.brunocasamassa.ajudaaqui W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
05-05 06:36:48.895 4791-4834/studio.brunocasamassa.ajudaaqui W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
05-05 06:36:48.912 4791-6318/studio.brunocasamassa.ajudaaqui V/FA: Activity paused, time: 2141000
05-05 06:36:48.936 4791-4791/studio.brunocasamassa.ajudaaqui V/FA: onActivityCreated
05-05 06:36:48.957 4791-6318/studio.brunocasamassa.ajudaaqui V/FA: Activity resumed, time: 2141044
05-05 06:36:49.122 4791-4791/studio.brunocasamassa.ajudaaqui W/IInputConnectionWrapper: finishComposingText on inactive InputConnection
05-05 06:36:50.541 4791-4805/studio.brunocasamassa.ajudaaqui D/FirebaseAuth: Notifying listeners about user (Onec4KwKzUUMA5mXualVJSovhum1).
05-05 06:36:50.541 4791-4791/studio.brunocasamassa.ajudaaqui D/FirebaseApp: Notifying auth state listeners.
05-05 06:36:50.542 4791-4791/studio.brunocasamassa.ajudaaqui D/FirebaseApp: Notified 0 auth state listeners.
05-05 06:36:59.008 4791-4834/studio.brunocasamassa.ajudaaqui W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
05-05 06:37:13.445 4791-6318/studio.brunocasamassa.ajudaaqui V/FA: Activity paused, time: 2165532
05-05 06:37:13.460 4791-6318/studio.brunocasamassa.ajudaaqui V/FA: Activity resumed, time: 2165547
05-05 06:37:13.626 4791-4791/studio.brunocasamassa.ajudaaqui W/IInputConnectionWrapper: finishComposingText on inactive InputConnection
UPDATING ERROR 它出現在控制檯現在
「7月5日至5日:34:38.011 24936-24967/studio.brunocasamassa.ajudaaqui E/DynamiteModule:無法加載模塊描述符類:在路徑中找不到類「com.google.android.gms.dynamite.descriptors.com.google.firebase.auth.ModuleDescriptor」:DexPathList [[zip文件]/data /app/studio.brunocasamassa.ajudaaqui-1/base.apk「,zip文件」/ d ata/app/studio.brunocasamassa.ajudaaqui-1/split_lib_dependencies_apk.apk「,zip文件」/data/app/studio.brunocasamassa.ajudaaqui-1/split_lib_slice_0_apk.apk「,zip文件」/data/app/studio.brunocasamassa。 ajudaaqui-1/split_lib_slice_1_apk.apk「,zip文件」/data/app/studio.brunocasamassa.ajudaaqui-1/split_lib_slice_2_apk.apk「,zip文件」/data/app/studio.brunocasamassa.ajudaaqui-1/split_lib_slice_3_apk.apk「 ,zip文件「/data/app/studio.brunocasamassa.ajudaaqui-1/split_lib_slice_4_apk.apk」,zip文件「/data/app/studio.brunocasamassa.ajudaaqui-1/split_lib_slice_5_apk.apk」,zip文件「/ data/app /studio.brunocasamassa.ajudaaqui-1/split_lib_slice_6_apk.apk「,zip文件」/data/app/studio.brunocasamassa.ajudaaqui-1/split_lib_slice_7_apk.apk「,zip文件」/data/app/studio.brunocasamassa.ajudaaqui-1 /split_lib_slice_8_apk.apk「,zip文件」/data/app/studio.brunocasamassa.ajudaaqui-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/studio.brunocasamassa.ajudaaqui-1/lib/x86,/ system/lib,/ vendor/lib]]
,這裏是我的活動(在cadastrarUsuario方法錯誤)
package studio.brunocasamassa.ajudaaqui;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseAuthInvalidCredentialsException;
import com.google.firebase.auth.FirebaseAuthWeakPasswordException;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DatabaseReference;
import studio.brunocasamassa.ajudaaqui.helper.Base64Decoder;
import studio.brunocasamassa.ajudaaqui.helper.FirebaseConfig;
import studio.brunocasamassa.ajudaaqui.helper.Preferences;
import studio.brunocasamassa.ajudaaqui.helper.User;
/**
* Created by bruno on 24/04/2017.
*/
public class CadastroActivity extends AppCompatActivity {
private Button cadastrar;
private EditText email;
private EditText nome;
private EditText senha;
private EditText senhaConfirm;
private FirebaseAuth autenticacao;
private DatabaseReference firebaseDatabase;
public User usuario;
private Base64Decoder decoder;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_cadastro);
nome = (EditText) findViewById(R.id.cadastro_nome);
email = (EditText) findViewById(R.id.cadastro_email);
senha = (EditText) findViewById(R.id.cadastro_senha);
senhaConfirm = (EditText) findViewById(R.id.cadastro_senhaConfirm);
cadastrar = (Button) findViewById(R.id.buttonValidarCadstro);
cadastrar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
usuario = new User();
usuario.setName(nome.getText().toString());
usuario.setEmail(email.getText().toString());
usuario.setSenha(senha.getText().toString());
System.out.println("EMAIL: " + usuario.getEmail() + "SENHA: " + usuario.getSenha());
cadastrarUsuario();
startActivity(new Intent(CadastroActivity.this, LoginActivity.class));
}
});
}
private void cadastrarUsuario() {
autenticacao = FirebaseConfig.getFirebaseAuthentication();
System.out.println("EMAIL: " + usuario.getEmail() + " SENHA: " + usuario.getSenha());
autenticacao.createUserWithEmailAndPassword("[email protected]", "superm34tboy"
).addOnCompleteListener(CadastroActivity.this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
// FirebaseUser usuarioFireBase = task.getResult().getUser();
String idUser = Base64Decoder.encoderBase64(usuario.getEmail());
System.out.println("BASE64 ENCODER: " + idUser);
usuario.setId(idUser);
usuario.save();
/*firebaseDatabase = FirebaseConfig.getFireBase();1
firebaseDatabase.child("usuarios").setValue(idUser);*/
firebaseDatabase = FirebaseConfig.getFireBase();
firebaseDatabase.child("pontos").setValue("300");
FirebaseUser usuarioFirebase = task.getResult().getUser();
usuario.setId(usuarioFirebase.getUid());
Preferences preferences = new Preferences(CadastroActivity.this);
preferences.saveData(idUser);
/*autenticacao.signOut();*/
Toast.makeText(CadastroActivity.this, "Usuario cadastrado com sucesso", Toast.LENGTH_LONG).show();
finish();
} else {
try {
System.out.println("TASK ERROR CARAIO " + task.getException().toString());
throw task.getException();
} catch (FirebaseAuthWeakPasswordException e) {
Toast.makeText(CadastroActivity.this, "Senha invalida, favor escolher outra senha para autenticacao", Toast.LENGTH_LONG).show();
} catch (FirebaseAuthInvalidCredentialsException e) {
Toast.makeText(CadastroActivity.this, "e-mail invalido, verifique os valores digitados", Toast.LENGTH_LONG).show();
} catch (Exception e) {
e.printStackTrace();
System.out.println("ERROR CARAIO " + e);
}
}
}
}
);
}
}
這裏是我的gradle構建信息:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "studio.brunocasamassa.ajudaaqui"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.facebook.android:facebook-android-sdk:4+'
compile 'com.google.firebase:firebase-database:9.6.1'
compile 'com.google.firebase:firebase-auth:9.6.1'
compile 'com.google.firebase:firebase-core:9.6.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support:design:23.1.1'
compile 'com.github.rtoshiro.mflibrary:mflibrary:1.0.0'
compile 'com.android.support:gridlayout-v7:23.1.1'
compile('com.mikepenz:materialdrawer:[email protected]') {
transitive = true
}
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
請幫助。
您好,我已經檢查過,這是ok..what否則可能? – 4ury0n