【问题标题】:firebase error W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not foundfirebase 错误 W/DynamiteModule:找不到 com.google.firebase.auth 的本地模块描述符类
【发布时间】:2017-01-10 23:38:27
【问题描述】:
  • 我尝试基于登录/注册帐户构建应用程序。
  • 我创建了它的 Firebase 并通过电子邮件启用身份验证。
  • 我添加了 google-play-services.json 文件。
  • 我加了

    apply plugin: 'com.google.gms.google-services'
    compile 'com.google.firebase:firebase-auth:10.0.1'
    

    在 build.grid(app) 中

    在我添加的模块中

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

    这是我的代码

    public class splashscr extends Activity implements View.OnClickListener{
    
    TabHost tab ;
    Button logbtn,signup;
    EditText email,password,signupemail,signuppassword;
    private FirebaseAuth firebaseAuth;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        tab =(TabHost) findViewById(R.id.tabhost);
        logbtn = (Button) findViewById(R.id.btn_login);
        signup = (Button) findViewById(R.id.btn_signup);
        password = (EditText)findViewById(R.id.input_password);
        email = (EditText)findViewById(R.id.input_email);
        signupemail =(EditText)findViewById(R.id.signupinput_email);
        signuppassword = (EditText) findViewById(R.id.signupinput_password);
        firebaseAuth = FirebaseAuth.getInstance();
        logbtn.setOnClickListener(this);
        signup.setOnClickListener(this);
        tab.setup();
    
        TabHost.TabSpec spec = tab.newTabSpec("tag1");
        spec.setIndicator("",getResources().getDrawable(R.drawable.loginpic));
        spec.setContent(R.id.tab1);
        tab.addTab(spec);
    
        spec = tab.newTabSpec("tag2");
        spec.setIndicator("",getResources().getDrawable(R.drawable.signupp));
        spec.setContent(R.id.tab2);
        tab.addTab(spec);
    }
    @Override
    public void onClick(View view) {
       final Intent I = new Intent(this,HomeActivity.class);
        final String emailout = signupemail.getText().toString();
        final String passwordout = signuppassword.getText().toString();
        if (view == signup){
            (firebaseAuth.createUserWithEmailAndPassword(emailout,passwordout)).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    if (task.isSuccessful()){
                        Toast.makeText(splashscr.this, "تم تسجيلك بنجاح ", Toast.LENGTH_SHORT).show();
                        startActivity(I);
                        finish();
                    }
                    else
                    {
                        Log.e("ERROR", task.getException().toString());
                        Toast.makeText(splashscr.this, "فشل التسجيل", Toast.LENGTH_SHORT).show();
                    }
                    Toast.makeText(splashscr.this,emailout+passwordout, Toast.LENGTH_SHORT).show();
                }
            });
        }
    }
    }
    

我得到这个错误:

E/ERROR: com.google.firebase.FirebaseException: An internal error has occurred. [ OPERATION_NOT_ALLOWED ]
W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.

怎么了?

【问题讨论】:

  • 还是没有解决办法?

标签: android firebase firebase-authentication


【解决方案1】:

尝试将您的客户端与您的 Firebase 应用重新同步,然后再次添加 .json 文件。 在 android studio 2.3 中,只需点击 tools>firebase 并在助手中检查您的应用是否已连接。

【讨论】:

    【解决方案2】:

    确保您的模拟器具有 Play 商店。

    如果您没有在模拟器上安装 Play 商店,则会出现此错误。

    【讨论】:

      【解决方案3】:

      登录到您的 Firebase 控制台并启用电子邮件/密码登录_方法,它应该可以解决问题。

      【讨论】:

        【解决方案4】:

        在您的 Firebase 控制台中检查是否允许“匿名身份验证”。它应该可以解决您的问题。

        还要检查清单中的 INTERNET 权限。这很明显,但是...

        祝你好运。

        【讨论】:

        • 添加互联网权限时出现同样的问题 E/ERROR: com.google.firebase.FirebaseException: An internal error has occurred。 [ OPERATION_NOT_ALLOWED ]
        【解决方案5】:

        更改 firebase 规则后,这个问题发生在我身上。我的 IOS 模拟器运行良好,但 Android Emu 没有。我通过在模拟器中擦除设备中的所有数据然后重新启动 EMU 来解决此问题。可能您甚至不需要从模拟设备中擦除数据。

        【讨论】:

          【解决方案6】:

          确保你必须照顾好

          互联网许可 ,编译库和 仅启用一个来自 firebase 身份验证列表的身份验证。

          在我的情况下,我从列表谷歌和电子邮件/密码启用 2 身份验证,所以这不起作用但在禁用谷歌之后......然后它可以正常工作。

          希望我的回答对你有所帮助。

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 2018-06-13
            • 2017-09-11
            • 2022-08-09
            • 2016-11-30
            • 2020-12-11
            • 1970-01-01
            • 2017-03-26
            • 2018-03-27
            相关资源
            最近更新 更多