主要活动未在AdroidManifest.xml中声明

问题描述 投票:0回答:2

每次我尝试启动我的应用程序时,它都会给我以下错误。

我已经尝试在启动选项中指定活动,禁用即时运行,并更改清单中的主启动器活动(以及启动选项),设置为默认活动,但没有任何作用。

这一切都始于我在Manifest中添加'Products Page'活动,以及com.android.feature和com.android.application的实现:

implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'com.google.firebase:firebase-database:16.0.1'
    implementation 'com.google.firebase:firebase-auth:16.0.3'
    implementation 'com.google.firebase:firebase-core:16.0.3'



     <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="br.com.app.coffeehour.coffee_hour">

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

        <application
            android:label="@string/app_name"
            android:supportsRtl="true"
            android:icon="@mipmap/ic_launcher"
            android:allowBackup="true">

            <activity android:name=".home.Home"
                android:theme="@style/CustomTheme"
                android:noHistory="true"
                android:label="@string/app_name">

                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />

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


            <activity android:name=".navigation.ActivityOne"
                android:theme="@style/CustomTheme"
                android:label="@string/app_name">
                <intent-filter android:order="1">
                    <action android:name="android.intent.action.VIEW" />

                    <category android:name="android.intent.category.BROWSABLE" />
                    <category android:name="android.intent.category.DEFAULT" />

                    <data
                        android:host="coffeehour.app.com.br"
                        android:pathPattern="/.*"
                        android:scheme="https" />
                </intent-filter>
            </activity>
            <activity android:name=".navigation.ActivityTwo"
                android:theme="@style/CustomTheme">
                <intent-filter android:order="1">
                    <action android:name="android.intent.action.VIEW" />

                    <category android:name="android.intent.category.BROWSABLE" />
                    <category android:name="android.intent.category.DEFAULT" />

                    <data
                        android:host="coffeehour.app.com.br"
                        android:pathPattern="/.*"
                        android:scheme="https" />
                </intent-filter>
            </activity>
            <activity android:name=".navigation.ActivityThree"
                android:theme="@style/CustomTheme"
                android:noHistory="true">
                <intent-filter android:order="1">
                    <action android:name="android.intent.action.VIEW" />

                    <category android:name="android.intent.category.BROWSABLE" />
                    <category android:name="android.intent.category.DEFAULT" />

                    <data
                        android:host="coffeehour.app.com.br"
                        android:pathPattern="/.*"
                        android:scheme="https" />
                </intent-filter>
            </activity>

 <!-- Products Page -->
        <activity
            android:name=".products.OpenScreen">
        </activity>
        <activity
            android:name=".products.NewUser"
            android:screenOrientation="portrait" />
        <activity
            android:name=".products.MainAppPage"
            android:label="@string/title_activity_main_app_page"
            android:screenOrientation="portrait"
            android:theme="@style/CustomTheme" />
        <activity
            android:name=".products.IndividualProduct"
            android:label="@string/title_activity_individual_product"
            android:screenOrientation="portrait"
            android:theme="@style/CustomTheme" />
        <activity android:name=".products.ShoppingCartWindow" />
        <activity android:name=".products.CheckOutScreen" />
        <activity android:name=".products.ForgotPassword" />
        <activity android:name=".products.IndividualProductSeller" />
        <activity android:name=".products.AddProductForm"></activity>

        </application>

    </manifest>
android-studio android-manifest android-launcher
2个回答
0
投票

有时当您更改Android studio Manifest上的MainActivity时,它会从缓存中编译,因此您问题的第一个解决方案是Goto - File-Invalidate Caches和Restart将解决您的问题。


0
投票

我更喜欢发布代码而不是屏幕截图:

我已经发送了清单代码,这里是MainActivity包名:

 package br.com.app.coffeehour.coffee_hour.home;

import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.design.widget.BottomNavigationView;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.Button;
import android.widget.ImageView;
import android.support.v7.widget.Toolbar;

import br.com.app.coffeehour.coffee_hour.R;
import br.com.app.coffeehour.coffee_hour.navigation.ActivityOne;
import br.com.app.coffeehour.coffee_hour.navigation.ActivityThree;
import br.com.app.coffeehour.coffee_hour.navigation.ActivityTwo;
© www.soinside.com 2019 - 2024. All rights reserved.