找不到显式活动类在androidmanifest.xml中

piok6c0g  于 2021-07-08  发布在  Java
关注(0)|答案(1)|浏览(485)

我试图在我的应用程序中实现firebase,但当我点击register或login时,这个错误弹出。从这里我可以看到我所有的页面都链接在mainifest.xml中
找不到显式活动类{edu.itsligo.gaa\u app/com.google.firebase.firestore.auth.user};您是否在androidmanifest.xml中声明了此活动?

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="edu.itsligo.gaa_app">

    <uses-permission android:name="android.permission.INTERNET" />

    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.GAAapp">
        <activity
            android:name=".User"
            android:theme="@style/AppTheme.NoActionBar"/>
        <activity android:name=".Admin" />
        <activity android:name=".Login" />
        <activity android:name=".Register" />
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

java类(单击登录或注册后)

public class User extends AppCompatActivity {

    private DrawerLayout draw;
    TextView email,username;
    FirebaseAuth fAuth;
    FirebaseFirestore fStore;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_user);
        Toolbar toolbar = findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        draw = findViewById(R.id.drawer_layout);
        // framnet for profile
        NavigationView navigationView = findViewById(R.id.nav_view);

//        email = findViewById(R.id.emailPlacehold);
//        username = findViewById(R.id.usernamePlacehold);
//
//        fAuth = FirebaseAuth.getInstance();
//        fStore = FirebaseFirestore.getInstance();
//
//
//
//        DocumentReference docRef = fStore.collection("Users").document(fAuth.getCurrentUser().getUid());
//        docRef.get().addOnSuccessListener(new OnSuccessListener<DocumentSnapshot>() {
//            @Override
//            public void onSuccess(DocumentSnapshot documentSnapshot) {
//                if(documentSnapshot.exists()){
//                    username.setText(documentSnapshot.getString("FullName"));
//                    email.setText(documentSnapshot.getString("UserEmail"));
//                }
//            }
//        });

        navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
            @Override
            public boolean onNavigationItemSelected(@NonNull MenuItem item) {
                switch (item.getItemId()){
                    case R.id.nav_Account:
                        getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container,
                                new ProfileFragment()).commit();
                        break;
                    case  R.id.nav_Games:
                        getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container,
                                new GamesFragment()).commit();

                        break;
                    default:

                }
                draw.closeDrawer(GravityCompat.START);
                return true;
            }
        });

        ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, draw, toolbar,
                R.string.nav_app_bar_open_drawer_description, R.string.navigation_drawer_close);
        draw.addDrawerListener(toggle);
        toggle.syncState();

        if(savedInstanceState == null){
            getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container,
                    new ProfileFragment()).commit();
            navigationView.setCheckedItem(R.id.nav_Account);
        }
    }

    @Override
    public void onBackPressed() {
        if (draw.isDrawerOpen(GravityCompat.START)) {
            draw.closeDrawer(GravityCompat.START);
        } else {
            super.onBackPressed();
        }
    }

    public void logoutUser(View view) {
        FirebaseAuth.getInstance().signOut();
        startActivity(new Intent(getApplicationContext(), Login.class));
        finish();
    }
}
pgccezyw

pgccezyw1#

我想你会的 import 错误的 User 班级。检查 import 用于导入 User 类并将其包从 Firebase 敬你的。应该是的 import edu.itsligo.gaa_app.User 对你来说。

相关问题