安装app后打不开

After app installation I can't open it

我创建了一个包含一些活动的简单应用程序。安装成功后,我无法打开该应用程序。我只能在设备的应用程序中看到它。

是的,当然要阅读所有告诉 "You have to set launcher activity" 的答案。但是我设置了启动器 activity.

这里是AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="cz.jacon.davodani"
android:versionCode="0"
android:versionName="0.1">

<application
    android:icon="@drawable/logo"
    android:label="@string/app_name"
    android:theme="@style/Theme">

</application>
<activity
    android:name=".activities.MainActivity"
    android:label="@string/app_name"
    android:screenOrientation="portrait"
    android:theme="@style/Theme.AppCompat.Light.NoActionBar">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>
<activity
    android:name=".activities.SearchActivity"
    android:label="@string/search_activity">
</activity>
<activity
    android:name=".activities.CustomerActivity"
    android:label="@string/customer_activity">
</activity>
<activity
    android:name=".activities.CreditActivity"
    android:label="@string/credit_activity">
</activity>
<activity
    android:name=".activities.PrintReceiptActivity"
    android:label="@string/print_receipt_activity">
</activity>
<activity
    android:name=".activities.ProductActivity"
    android:label="@string/product_activity">
</activity>

我从来没有遇到过...你能给我一些建议吗?非常感谢

您的所有活动都需要在 <application> 标签内定义。

 <application
    android:icon="@drawable/logo"
    android:label="@string/app_name"
    android:theme="@style/Theme">

   <!-- Add activites here -->

</application>

您的清单应如下所示:

<?xml version="1.0" encoding="utf-8"?>
<manifest 
xmlns:android="http://schemas.android.com/apk/res/android"
package="cz.jacon.davodani"
android:versionCode="0"
android:versionName="0.1">

<application
    android:icon="@drawable/logo"
    android:label="@string/app_name"
    android:theme="@style/Theme">
    <activity
        android:name=".activities.MainActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:theme="@style/Theme.AppCompat.Light.NoActionBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    ...
    ...
</application>
</manifest>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="cz.jacon.davodani"
android:versionCode="0"
android:versionName="0.1">

<application
    android:icon="@drawable/logo"
    android:label="@string/app_name"
    android:theme="@style/Theme">

<activity
    android:name=".activities.MainActivity"
    android:label="@string/app_name"
    android:screenOrientation="portrait"
    android:theme="@style/Theme.AppCompat.Light.NoActionBar">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>
<activity
    android:name=".activities.SearchActivity"
    android:label="@string/search_activity">
</activity>
<activity
    android:name=".activities.CustomerActivity"
    android:label="@string/customer_activity">
</activity>
<activity
    android:name=".activities.CreditActivity"
    android:label="@string/credit_activity">
</activity>
<activity
    android:name=".activities.PrintReceiptActivity"
    android:label="@string/print_receipt_activity">
</activity>
<activity
    android:name=".activities.ProductActivity"
    android:label="@string/product_activity">
</activity>

</application>
</manifest>

尝试用这个替换您的清单..

将您的 AndroidManifest.xml 结构更改为 -

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="cz.jacon.davodani"
android:versionCode="0"
android:versionName="0.1">

<application
    android:icon="@drawable/logo"
    android:label="@string/app_name"
    android:theme="@style/Theme">

    <activity
        android:name=".activities.MainActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:theme="@style/Theme.AppCompat.Light.NoActionBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name=".activities.SearchActivity"
        android:label="@string/search_activity">
    </activity>
    <activity
        android:name=".activities.CustomerActivity"
        android:label="@string/customer_activity">
    </activity>
    <activity
        android:name=".activities.CreditActivity"
        android:label="@string/credit_activity">
    </activity>
    <activity
        android:name=".activities.PrintReceiptActivity"
        android:label="@string/print_receipt_activity">
    </activity>
    <activity
        android:name=".activities.ProductActivity"
        android:label="@string/product_activity">
    </activity>

  </application>
</manifest>

所有活动标签必须放在 <application> 标签内,并且应该放在 <manifest> 标签内。