如何解决无法在Firebase AuthUi中找到显式活动? [英] how to solve Unable to find explicit activity in firebase AuthUi?

查看:104
本文介绍了如何解决无法在Firebase AuthUi中找到显式活动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用Firebase UI时,我无法找到显式的活动类com.firebase.ui.auth.KickoffActivity

While working with firebase UI I am getting Unable to find explicit activity class com.firebase.ui.auth.KickoffActivity

 protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    FirebaseApp.initializeApp(this);
    setContentView(R.layout.activity_main);
    FirebaseApp.initializeApp(this);
    mAuth=FirebaseAuth.getInstance();
    mAuthListner=new FirebaseAuth.AuthStateListener() {
        @Override
        public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
            FirebaseUser user=firebaseAuth.getCurrentUser();
            if(user!=null){
                Toast.makeText(getApplicationContext(),"Sign in success",Toast.LENGTH_SHORT).show();

            }
            else {
                startActivityForResult(AuthUI.getInstance()
                        .createSignInIntentBuilder()
                        .setIsSmartLockEnabled(false)
                        .setProviders(AuthUI.EMAIL_PROVIDER,AuthUI.GOOGLE_PROVIDER).build(),
                        RC_SIGN_IN);
            }
        }
    };
}

完整的错误消息

android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.flamanco.trackme/com.firebase.ui.auth.KickoffActivity}; have you declared this activity in your AndroidManifest.xml? at android.app.Instrumentation.checkStartActivityResult

添加了对app/.gradle文件的依赖

Added dependencies on app/.gradle file

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.2.1'
    compile 'com.google.firebase:firebase-core:10.0.1'
    compile 'com.google.firebase:firebase-auth:10.0.1'
    compile 'com.firebaseui:firebase-ui-auth:1.1.1'
}

apply plugin: 'com.google.gms.google-services'

还在build gradle中添加了插件

also added plugin in build gradle

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

最后,我确实在Firebase控制台项目中添加了SHA1指纹.

Finally I did added SHA1 fingerprint in my firebase console project.

我是否需要在清单文件中添加auth.kickOff活动

Do I need to add auth.kickOff activity in manifest file

推荐答案

最后,我已将android studio完全重新安装到最新版本,并更新了包括

Finally I have completely reinstall android studio to latest version, updated everything including

  • Google play服务
  • firebase库
  • 渐变版本
  • google repositoris

我从头开始了新项目,并且没有错误地工作. 添加AUTHUI依赖项后会自动添加许多活动. 这些活动包括启动活动,恢复密码活动,registerEmailActivity等 我可以通过转到路径来验证

And I started new project from begining and worked with no error. there are many activities that are added automatically on adding AUTHUI dependencies. these activity includes kickoffactivity,recoverpasswordactivity,registerEmailActivity,etc I can verify if by going to path

/project/module/build/intermediates/manifests/full/debug/And‌​roidManifest.xml.

以前我在此清单文件中没有启动活动,我不知道原因,但是现在我知道了.我认为手动将其添加到应用程序清单文件中是行不通的.

previously i don't have kickoffactivity in this manifest file, I don't know the reason,but now i have it.I don't think adding it manually on app's manifest file will work.

这篇关于如何解决无法在Firebase AuthUi中找到显式活动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆