Iancu Vlad
Iancu Vlad

Reputation: 177

Android application crashing, manifest issue

Heloo! I am creating an application in Android. I have declared all my activities in Android manifest, including the main one, and when i start it, it says that the activity i have selected as launcher does not exist:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.boacterapp"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
                     android:maxSdkVersion="18" />

    <uses-sdk
        android:minSdkVersion="10"
        android:targetSdkVersion="22" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="MainPage"
            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="AboutPage" 
    android:label="title_firskljt_activity">
        </activity>

        <activity 
    android:name="RecentSightingsPage" 
    android:label="title_first_activity">
        </activity>

    </application>

</manifest>

I have been stuck here for a while, so i'm kindly asking that you could help me identity if i have a problem in my manifest. Thank you in advance!

Upvotes: 3

Views: 1018

Answers (4)

Gilad Haimov
Gilad Haimov

Reputation: 5867

Make sure MainPage activity is in package "com.example.boacterapp".


Another option: replace short name:

   android:theme="@style/AppTheme" >
        <activity
            android:name="MainPage"  <-----------------   short
            android:label="@string/app_name" >
            <intent-filter>

With long name that makes up the full class name of your activity:

   android:theme="@style/AppTheme" >
        <activity
            android:name="com.bla.bla.MainPage"  <-------------  long 
            android:label="@string/app_name" >
            <intent-filter>

Upvotes: 2

Giru Bhai
Giru Bhai

Reputation: 14408

Add "." (dot) before MainPage

as

 android:name=".MainPage"

Same for others,so rewrite your manifest as

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.boacterapp"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
                     android:maxSdkVersion="18" />

    <uses-sdk
        android:minSdkVersion="10"
        android:targetSdkVersion="22" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainPage"
            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=".AboutPage" 
    android:label="title_firskljt_activity">
        </activity>

        <activity 
    android:name=".RecentSightingsPage" 
    android:label="title_first_activity">
        </activity>

    </application>

</manifest>

Upvotes: 2

Pr38y
Pr38y

Reputation: 1565

Activity name should have dot prefix, change activity name to .MainPage. Make sure it is inside com.example.boacterapp package

Upvotes: 0

Kevin Coppock
Kevin Coppock

Reputation: 134714

<activity android:name="MainPage"

should be:

<activity android:name=".MainPage"

assuming that your MainPage activity is in the package com.example.boacterapp. If not, you need to provide the fully-qualified name of the MainPage app.

Upvotes: 0

Related Questions