The_Martian The_Martian - 1 month ago 12
Android Question

Android Error: Default Activity not found

I have a launcher activity but android studio says "Default activity not found". This started after I added a login activity which I wanted it to be the launcher activity (meant for when the user signs up only). So I would like the Main activity to be the launcher activity once the user installs my app and provide their credentials. Your help is much appreciated.
This is my manifest with both my login and main activities.

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

<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="22" />
<library />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.BATTERY_STATS"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"/>
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
<uses-permission android:name="android.permission.SEND_SMS"/>
<uses-permission android:name="android.permission.WRITE_SMS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="mypackage.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="otherpackage.permission.C2D_MESSAGE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>

<permission
android:name="mypackage.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<permission
android:name="com.google.android.c2dm.permission.RECEIVE"></permission>
<permission
android:name="otherpackage.permission.C2D_MESSAGE"
android:protectionLevel="signature"></permission>

<application
android:allowBackup="true"
android:icon="@drawable/image"
android:label="@string/app_name"
android:theme="@style/AppTheme" >

<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="key"/>
<Activity
android:name=".Login"
android:label="REGISTER"
android:noHistory="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</Activity>
<Activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAINACTIVITY" />

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

<Activity
android:name=".MapActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAPACTIVITY" />

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

<!--<activity
android:name=".MyMapActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MYMAPACTIVITY" />

<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>-->
<receiver
android:name="com.google.android.gms.gcm.GcmReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<!--Receives the actual messages. -->
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<!--this is to support pre KitKat -->
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="mypackage" />
<category android:name="otherpackage" />
</intent-filter>
</receiver>
<receiver android:name=".MapActivity$ResponseReceiver">
<intent-filter>
<action android:name="mypackage.MapActivity.ResponseReceiver.ACTION_RESP" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<service
android:name=".MapActivity$MyGcmListenerService"
android:exported="false" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
<service
android:name=".Login$MyInstanceIDListenerService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.gms.iid.InstanceID"/>
</intent-filter>
</service>
<service android:name="mypackage.RegistrationIntentService"></service>

<service
android:name=".FetchAddressIntentService"
android:exported="false"/>

</application>

</manifest>


This is the main activity.

public class MainActivity extends MapActivity {

@Override
public void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

new Handler().postDelayed(new Runnable() {
@Override
public void run() {

Intent i = new Intent(MainActivity.this, MapActivity.class);
startActivity(i);
}
}, 8000);
}
}


N.B The main activity extends my MapActivity, which extends FragmentActivity. It is starnge but I found this in logcat. I haven't implemented iheartradio library or anything. "Caused by: java.lang.ClassNotFoundException: com.clearchannel.iheartradio.alarm.LiveDeltaUpdateService"

Answer
  change Activity to activity in manifest file

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

    <uses-sdk
        android:minSdkVersion="11"
        android:targetSdkVersion="22" />
    <library />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
    <uses-permission android:name="android.permission.BATTERY_STATS"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.CALL_PHONE" />
    <uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"/>
    <uses-permission android:name="android.permission.RECEIVE_SMS"/>
    <uses-permission android:name="android.permission.SEND_SMS"/>
    <uses-permission android:name="android.permission.WRITE_SMS" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
    <uses-permission android:name="mypackage.permission.MAPS_RECEIVE"/>
    <uses-permission android:name="android.permission.WAKE_LOCK"/>
    <uses-permission android:name="otherpackage.permission.C2D_MESSAGE" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS"/> 
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> 
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true"/>

    <permission
        android:name="mypackage.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />
    <permission 
        android:name="com.google.android.c2dm.permission.RECEIVE"></permission>
    <permission 
        android:name="otherpackage.permission.C2D_MESSAGE"
        android:protectionLevel="signature"></permission>

    <application
        android:allowBackup="true"
        android:icon="@drawable/image"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >

        <meta-data android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />
        <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="key"/>
        <activity
            android:name=".Login"
            android:label="REGISTER"
            android:noHistory="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAINACTIVITY" />

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

        <activity
            android:name=".MapActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAPACTIVITY" />

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

        <!--<activity
            android:name=".MyMapActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MYMAPACTIVITY" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>-->
        <receiver
            android:name="com.google.android.gms.gcm.GcmReceiver"
            android:permission="com.google.android.c2dm.permission.SEND" >
            <intent-filter>
        <!--Receives the actual messages. -->
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
        <!--this is to support pre KitKat -->
                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
                <category android:name="mypackage" />
                <category android:name="otherpackage" />
            </intent-filter>
        </receiver>
        <receiver android:name=".MapActivity$ResponseReceiver">
            <intent-filter>
                <action android:name="mypackage.MapActivity.ResponseReceiver.ACTION_RESP" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </receiver>
        <service
            android:name=".MapActivity$MyGcmListenerService"
            android:exported="false" >
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            </intent-filter>
        </service>
        <service
            android:name=".Login$MyInstanceIDListenerService"
            android:exported="false">
            <intent-filter>
                <action android:name="com.google.android.gms.iid.InstanceID"/>
            </intent-filter>
        </service>
        <service android:name="mypackage.RegistrationIntentService"></service>

        <service
            android:name=".FetchAddressIntentService"
            android:exported="false"/>

    </application>

</manifest>
Comments