2

If on run/debug configuration, if I specify a launch activity, then my app runs fine, but when I select 'Launch Default Activity' I get "No Launcher activity found!" error from android adb despite the fact that I have specified the launch activity in my manifest file. I'm using android 2.1.

I've tried refreshing the file/project, clean and rebuild, deleting the file and re-writing it, creating a new project and copy/pasting all the code across and doing Android Tools -> Fix Project Properties. I've tried Android Tools-> Rename Application Package, which prompts me to update the project launch configuration (to which I say yes, but it still doesn't fix the problem).

I've also tried different devices. My Home activity extends another activity and is in its own Home.java file in my src folder. This is what my manifest file looks like:

<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.geogreenweb.localvore"
  android:versionCode="1"
  android:versionName="1.0">

<application 
    android:icon="@drawable/icon" 
    android:label="@string/general_app_name" 
    android:debuggable="true">

    <meta-data android:name="android.app.default_searchable"
           android:value=".localvorebeta6" />

    <activity android:name="com.geogreenweb.localvore.Home" 
              android:label="@string/general_app_name">

              <intent-filter>
              <action android:name="android.intent.action.MAIN" />
              <category android:name="android.intent.category.LAUNCHER" />                  
              <action android:name="android.intent.action.SEARCH" />
              </intent-filter>
              <meta-data android:name="android.app.searchable"
               android:resource="@xml/searchable"/>


    </activity>

    <activity android:name="com.geogreenweb.localvore.Quit" 
              android:label="Quit">

    </activity>

    <activity android:name="com.geogreenweb.localvore.InSeason" 
              android:label="In Season">
              <intent-filter>                
              <action android:name="android.intent.action.SEARCH" />
              </intent-filter>
              <meta-data android:name="android.app.searchable"
               android:resource="@xml/searchable"/>

    </activity>

    <activity android:name="com.geogreenweb.localvore.List" 
              android:label="A - Z">
              <intent-filter>                  
              <action android:name="android.intent.action.SEARCH" />
              </intent-filter>
              <meta-data android:name="android.app.searchable"
               android:resource="@xml/searchable"/>

    </activity>

    <activity android:name="com.geogreenweb.localvore.Local" 
              android:label="Local"
              android:configChanges="orientation"
              android:windowSoftInputMode="stateHidden">
              <intent-filter>                  
              <action android:name="android.intent.action.SEARCH" />
              </intent-filter>
              <meta-data android:name="android.app.searchable"
               android:resource="@xml/searchable"/>

    </activity>

    <activity android:name="com.geogreenweb.localvore.Details" 
              android:label="Details">
              <intent-filter>                  
              <action android:name="android.intent.action.SEARCH" />
              </intent-filter>
              <meta-data android:name="android.app.searchable"
               android:resource="@xml/searchable"/>

    </activity>

    <activity android:name="com.geogreenweb.localvore.Search" 
              android:label="Search">
              <intent-filter>                  
              <action android:name="android.intent.action.SEARCH" />
              </intent-filter>
              <meta-data android:name="android.app.searchable"
               android:resource="@xml/searchable"/>

    </activity>

    <activity android:name="com.geogreenweb.localvore.Map" 
              android:label="Map"
              android:windowSoftInputMode="stateHidden">
              <intent-filter>                  
              <action android:name="android.intent.action.SEARCH" />
              </intent-filter>
              <meta-data android:name="android.app.searchable"
               android:resource="@xml/searchable"/>

    </activity>

    <activity android:name="com.geogreenweb.localvore.Help" 
              android:label="Help">
              <intent-filter>                  
              <action android:name="android.intent.action.SEARCH" />
              </intent-filter>
              <meta-data android:name="android.app.searchable"
               android:resource="@xml/searchable"/>

    </activity>


</application>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />    
<uses-permission android:name="android.permission.INTERNET" />
<uses-sdk android:minSdkVersion="7" />
</manifest>

UPDATE: I changed one of the activity labels, and the different label appears in the app, so the changes to the manifest file are being picked up, but still I get the No Launch Activity error

UPDATE 2: I managed to solve the problem by creating a new project in the end, but only if I select the option to create an activity when making the new project, then copy/paste in the rest of the stuff into the project

James Coote
  • 1,975
  • 19
  • 29
  • I should add that when I change and save the manifest file, I can see eclipse (re)building the project in the background. However, it does not give me the "Launch Configuration Update" dialogue: http://img855.imageshack.us/img855/2448/launchconfigchanges.png (only appears when I try to change the package name as in the above example) – James Coote Dec 13 '11 at 22:46

3 Answers3

2

The only thing I can think of is the lines

<activity android:name="com.geogreenweb.localvore.Home" 

Try using just

<activity android:name=".Home" 

instead

Bill Gary
  • 2,987
  • 2
  • 15
  • 19
  • `Home extends MenuActivity`, Home.java. MenuActivity is abstract, so it wasn't in my manifest. Adding it however, to the manifest file, did not solve the problem – James Coote Dec 13 '11 at 21:49
2

if you remove the :

<action android:name="android.intent.action.SEARCH" />

it will launch normally. i don't know why .. it just worked for me. i'm still searching why?!!

UPDATE 1: i found this:

No Launcher activity found, despite being declared in manifest.xml still don't know why? .. still searching for it.

UPDATE 2: GOT IT!

http://developer.android.com/guide/topics/intents/intents-filters.html

A filter has fields that parallel the action, data, and category fields of an Intent object. An implicit intent is tested against the filter in all three areas. To be delivered to the component that owns the filter, it must pass all three tests. If it fails even one of them, the Android system won't deliver it to the component — at least not on the basis of that filter. However, since a component can have multiple intent filters, an intent that does not pass through one of a component's filters might make it through on another.

in our case this means that the system sends an intent with the MAIN action and LAUNCH category. it finds an with the following:

  1. MAIN action ..............[ pass ]
  2. LAUNCH category .... [ pass ]
  3. SEARCH action .........[ fail ]

but .. if you put the SEARCH action in another , the containing the MAIN and LAUNCHER criteria passes.

Community
  • 1
  • 1
kdehairy
  • 2,630
  • 22
  • 27
1

Try adding the following to your main launcher Activity right next to the launcher category element.

<category android:name="android.intent.category.DEFAULT"/>
Argyle
  • 3,324
  • 25
  • 44
  • Didn't work either. I tried changing the order of the category and action elements within the action element, even thoughin theory it shouldn't matter. That didn't make a difference either – James Coote Dec 13 '11 at 22:41