android-studio - Android AndroidManifest 文件中 改变程序主入口的问题。
天蓬老师
天蓬老师 2017-04-17 16:16:43
0
4
572

我的程序本来是将MainActivity作为程序主入口,代码如下

<application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <meta-data
            android:name="com.baidu.lbsapi.API_KEY"
            android:value="xxxxxxxxxxxxxxxxxxxx" />

        <activity
            android:name=".activity.MainActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

        </activity>

        <activity android:name=".activity.SearchActivity" />


        <activity android:name=".activity.LoginActivity" />


        <activity android:name=".activity.RegisterActivity"/>

        <service
            android:name="com.baidu.location.f"
            android:enabled="true"
            android:process=":remote" />

    </application>

现在想将 LoginActivity 作为程序的主入口,将代码改成这样

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <meta-data
            android:name="com.baidu.lbsapi.API_KEY"
            android:value="xxxxxxxxxxxxxxxxxx" />

        <activity
            android:name=".activity.MainActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar">


        </activity>

        <activity android:name=".activity.SearchActivity" />


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

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


        <activity android:name=".activity.RegisterActivity"/>

        <service
            android:name="com.baidu.location.f"
            android:enabled="true"
            android:process=":remote" />

    </application>

结果现在一安装运行就提示 程序已停止运行

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(4)
黄舟

Where is your error log? In theory, there will be no problem simply changing the entry. Your LoginActivity should be abnormal.

迷茫

I agree with the opinion above. It should not be a problem with the registration file, but an exception in the java code.

Look at the error log exported by logcat and upload it.

小葫芦

How to solve the problem if there is no log/...

Peter_Zhu

Post the log for everyone to see

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template