简体   繁体   English

无法解析方法setAllowNewEmailsAccounts

[英]cannot resolve method setAllowNewEmailsAccounts

Am getting an error "error: cannot find symbol method setAllowNewEmailsAccounts(boolean) " this is the piece of my code that might help figure out the solution. 出现错误“错误: 找不到符号方法setAllowNewEmailsAccounts(boolean) ”,这是我的代码片段,可能有助于找出解决方案。 is the method outdated and if yes, how can I implement the new method? 该方法是否过时?如果是,该如何实现新方法?

public class MainActivity extends AppCompatActivity {
Button btnLogin;
private final static int LOGIN_PERMISSION=1000;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    btnLogin = (Button)findViewById(R.id.btnSignIn);
    btnLogin.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            startActivityForResult(
                    AuthUI.getInstance().createSignInIntentBuilder()
                    .setAllowNewEmailsAccounts(true).build(),LOGIN_PERMISSION
            );

        }
    });

}

You are using outdated code for Firebase AuthUI: 您正在为Firebase AuthUI使用过时的代码:

Here is how you make Email sign In with AllowNewEmailAccounts : 这是您使用AllowNewEmailAccounts进行电子邮件登录的方式

replace the code inside your onClick() function with this. 以此替换onClick()函数中的代码。

List<AuthUI.IdpConfig> providers = Collections.singletonList(
                        new AuthUI.IdpConfig.EmailBuilder().setAllowNewAccounts(true).build());

startActivityForResult(
                        AuthUI.getInstance()
                                .createSignInIntentBuilder()
                                .setLogo(your app logo)
                                .setAvailableProviders(providers)
                                .build(),
                        LOGIN_PERMISSION);

Google made some changes in latest version of Firebase Auth Ui library. Google在最新版本的Firebase Auth Ui库中进行了一些更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM