- I tried to build app based on login/signup accounts.
- 我尝试构建基于登录/注册帐户的应用程序。
- I created it's Firebase and enable the authentication through email.
- 我创建了它的Firebase,并通过电子邮件启用身份验证。
- I added the google-play-services.json file.
- 我添加了google-play-services。json文件。
-
I added
我添加了
apply plugin: 'com.google.gms.google-services' compile 'com.google.firebase:firebase-auth:10.0.1'
in build.gridle(app)
在build.gridle(应用)
And in the module I added
在模块中我添加了。
classpath 'com.google.gms:google-services:3.0.0'
And this is my code
这是我的代码。
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(); } }); } } }
And I get this error:
我得到了这个错误:
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.
what is the wrong?
是什么错了吗?
4 个解决方案
#1
7
Try re sync your client with your Firebase app, and add again the .json file. In android studio 2.3 just click on tools>firebase and in the assistant check if your app is connected to.
尝试用您的Firebase应用程序重新同步您的客户端,并再次添加.json文件。在android studio 2.3中,只要点击工具>firebase,然后在助手检查你的应用是否连接。
#2
1
Log into your firebase console and Enable Email/Password Sign-In_Method, it should solve the issue.
登录到您的firebase控制台,并启用电子邮件/密码签名- in_method,它应该能够解决这个问题。
#3
0
Check in your Firebase console that "anonymous auth" is allowed. It should solve your problem.
检查您的Firebase控制台,允许“匿名auth”。它应该能解决你的问题。
Also check INTERNET permission in your manifest. It so obvious, but...
在你的清单中也要检查网络许可。那么明显,但是……
Good Luck.
祝你好运。
#4
#1
7
Try re sync your client with your Firebase app, and add again the .json file. In android studio 2.3 just click on tools>firebase and in the assistant check if your app is connected to.
尝试用您的Firebase应用程序重新同步您的客户端,并再次添加.json文件。在android studio 2.3中,只要点击工具>firebase,然后在助手检查你的应用是否连接。
#2
1
Log into your firebase console and Enable Email/Password Sign-In_Method, it should solve the issue.
登录到您的firebase控制台,并启用电子邮件/密码签名- in_method,它应该能够解决这个问题。
#3
0
Check in your Firebase console that "anonymous auth" is allowed. It should solve your problem.
检查您的Firebase控制台,允许“匿名auth”。它应该能解决你的问题。
Also check INTERNET permission in your manifest. It so obvious, but...
在你的清单中也要检查网络许可。那么明显,但是……
Good Luck.
祝你好运。