0

bekomme ich folgende Fehlermeldung:Firebase AuthListener nicht funktioniert

W/DynamiteModule: Local module descriptor class for com.google.firebase.auth 
not found 

Mein Code funktioniert perfekt, wenn ich entscheiden, die Authentifizierung innerhalb der onCompleteListener zu handhaben, aber wenn ich versuche, es zu handhaben von den FirebaseAuth.AuthStateListener, bekomme ich einen Fehler .

Hier ist meine signin/Anmeldungen Aktivität:

public class MainActivity extends AppCompatActivity implements 
AdapterView.OnItemSelectedListener { 

EditText number; 
EditText ans; 
TextView questionText; 
Spinner country_code; 
String[] codes; 
String c_code; 
Button next_button_1; 
ArrayAdapter<String> adapter; 
FirebaseAuth mAuth; 
FirebaseAuth.AuthStateListener mAuthListener; 

Random rand = new Random(); 

int a = rand.nextInt(10); 
int b = rand.nextInt(10); 
int c = a+b; 

String tes; 
String ran2; 
String ran1; 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_main); 


    codes = new String[] {"+237","+233","+234"}; 
    number = (EditText) findViewById(R.id.editText1); 
    ans = (EditText) findViewById(R.id.editText_question); 
    questionText = (TextView) findViewById(R.id.questionText); 


    ran1 = Integer.toString(a); 
    ran2 = Integer.toString(b); 
    tes = Integer.toString(c); 
    questionText.setText(ran1 + " + " + ran2 + " = "); 

    country_code = (Spinner) findViewById(R.id.spinner_country_codes); 
    country_code.setOnItemSelectedListener(this); 
    adapter = new ArrayAdapter<>(this, 
      android.R.layout.simple_list_item_1, 
      codes); 
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); 
    country_code.setAdapter(adapter); 

    next_button_1 = (Button) findViewById(R.id.sign_in_next_button); 

    mAuth = FirebaseAuth.getInstance(); 
    mAuthListener = new FirebaseAuth.AuthStateListener() { 

     @Override 
     public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) { 
      if (firebaseAuth.getCurrentUser() != null) { 
       FirebaseUser user = firebaseAuth.getCurrentUser(); 
       String uid = user.getUid(); 
       Intent i = new Intent(MainActivity.this,Main2Activity.class); 
       i.putExtra("uid", uid); 
       i.putExtra("telephone", number.getText().toString()); 
       i.putExtra("country_code",c_code); 
       startActivity(i); 
      } 
     } 
    }; 

    if(next_button_1!=null){ 
     next_button_1.setOnClickListener(new View.OnClickListener() { 
      @Override 
      public void onClick(View v) { 
       /* 
       Intent intent = new Intent(MainActivity.this, 
Main2Activity.class); 
       startActivity(intent); 
       */ 
       String answer = ans.getText().toString(); 
       if(answer.equals(tes)) { 
        String telphone_number = number.getText().toString(); 
        if (TextUtils.isEmpty(c_code) || 
TextUtils.isEmpty(telphone_number)) { 
         Toast.makeText(MainActivity.this, "Empty field 
detected", Toast.LENGTH_SHORT).show(); 
        } else { 
         String email = c_code + telphone_number + 
"mydomain.com"; 
         String password = c_code + telphone_number; 
         startSignIn(email, password); 
        } 
       }else { 
        a = rand.nextInt(10); 
        b = rand.nextInt(10); 
        c = a + b; 

        ran1 = Integer.toString(a); 
        ran2 = Integer.toString(b); 
        tes = Integer.toString(c); 

        questionText.setText(ran1 + " + " + ran2 + " = "); 
        Toast.makeText(MainActivity.this, "Your math test answer 
is wrong.", Toast.LENGTH_LONG).show(); 
       } 
      } 
     }); 
    } 
} 

@Override 
public void onItemSelected(AdapterView<?> parent, View view, int position, 
long id) { 
    String c_code = codes[position].toString(); 
    this.c_code=c_code; 
} 

@Override 
public void onNothingSelected(AdapterView<?> parent) { 
} 



public void startSignIn(final String e,final String p) { 
    //Toast.makeText(MainActivity.this, "email is "+ email +" and password 
is "+ password + "." , Toast.LENGTH_SHORT).show(); 
     mAuth.signInWithEmailAndPassword(e, p) 
      .addOnCompleteListener(this, new OnCompleteListener<AuthResult> 
() { 
       @Override 
       public void onComplete(@NonNull Task<AuthResult> task) { 
        if (!task.isSuccessful()) { 
         Toast.makeText(MainActivity.this, "Account not 
found.", 
           Toast.LENGTH_SHORT).show(); 
         Toast.makeText(MainActivity.this, "Creating a new 
Account.", 
           Toast.LENGTH_LONG).show(); 
         createAccont(e, p); 
        } 
       } 
      }); 
} 

public void createAccont(String e, String p){ 
    mAuth.createUserWithEmailAndPassword(e, p) 
      .addOnCompleteListener(this, new OnCompleteListener<AuthResult> 
() { 
       @Override 
       public void onComplete(@NonNull Task<AuthResult> task) { 
        if (!task.isSuccessful()) { 
         Toast.makeText(MainActivity.this, "Authentication 
Failed", 
           Toast.LENGTH_SHORT).show(); 
        } 
       } 
      }); 
} 

} 

Meine build.gradle Datei ist wie folgt:

apply plugin: 'com.android.application' 

android { 
compileSdkVersion 24 
buildToolsVersion '24.0.3' 

packagingOptions { 
    exclude 'META-INF/LICENSE' 
    exclude 'META-INF/LICENSE-FIREBASE.txt' 
    exclude 'META-INF/NOTICE' 
} 

defaultConfig { 
    applicationId "biz.batto.mobilemoneymarket" 
    minSdkVersion 16 
    targetSdkVersion 24 
    versionCode 1 
    versionName "1.0" 
} 
buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), '  
proguard-rules.pro' 
    } 
} 
} 

dependencies { 
compile fileTree(include: ['*.jar'], dir: 'libs') 
testCompile 'junit:junit:4.12' 
compile 'com.android.support:appcompat-v7:24.2.1' 
compile 'com.android.support:design:24.2.1' 
compile 'com.google.firebase:firebase-core:9.6.1' 
compile 'com.google.firebase:firebase-database:9.6.1' 
//compile 'com.google.firebase:firebase-storage:9.6.1' 
//compile 'com.google.firebase:firebase-crash:9.6.1' 
compile 'com.google.firebase:firebase-auth:9.6.1' 
//compile 'com.google.firebase:firebase-messaging:9.6.1' 
compile 'com.google.firebase:firebase-config:9.6.1' 
compile 'com.google.firebase:firebase-invites:9.6.1' 
//compile 'com.google.firebase:firebase-ads:9.6.1' 
compile 'com.firebase:firebase-client-android:2.5.2' 
compile 'com.firebaseui:firebase-ui:0.6.0' 
compile 'com.google.android.gms:play-services-auth:9.6.1' 

compile 'com.google.android.gms:play-services-appindexing:9.6.1' 
} 
apply plugin: 'com.google.gms.google-services' 

Auch ich möchte Sie wissen lassen, dass ich alle meine SDK-Bibliotheken up-to-date und die Google Play Services auf meinem AVD sind ebenfalls auf dem neuesten Stand.

Von meiner MainActivity aus versuche ich zuerst den Benutzer zu authentifizieren. Wenn das fehlschlägt, versuche ich, Ihnen einen Account zu erstellen. Wenn ich diesen Code ausführe und den Kontoerstellungsprozess (oder Anmeldeprozess) teste, wird das neue Konto tatsächlich in meiner Firebase-Konsole erstellt, aber AuthStateListener wird nicht benachrichtigt.

Daher wird meine zweite Aktivität nicht gestartet und mein Benutzer bleibt auf der gleichen Aktivität, ohne dass die App abstürzt. Ich bekomme auch die Anmeldung am Android-Monitor:

W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found. 

Dies begann nur heute. Ich habe mich seit einiger Zeit ohne Probleme auf Firebase authentifiziert. Was kann ich tun?

+0

den Fehler zu beheben wäre, dass Sie Das Erhalten ist ähnlich diesem http://stackoverflow.com/questions/38602672/local-module-descriptor-class-for-comp-google-firebase-auth-not-found. –

+0

@Ignacio 'minfyEnabled' true hat nicht funktioniert für mich .... ich bekomme immer noch den gleichen Fehler. –

+0

Bitte beziehen Sie sich auf diesen Link, ich habe geantwortet: http://Stackoverflow.com/a/43680527/2581109 –

Antwort

1

konfrontiert ich das gleiche Problem, gegoogelt ein wenig denke ich, ein Maven-Repository auf dem gradle und hat dieses Bild auf Projektebene gradle

allprojects { 
    repositories { 
     // ... 
     maven { url 'https://maven.fabric.io/public' } 
    } } 

das Problem

+0

danke..ich werde es versuchen –