9

I am creating new android projects in Eclipse Juno with the latest ADT plugin and im running into a problem with the name of the app. Whenever I run the app, it runs fine, but when I go to the app list, the name of the app isnt there. Instead I have a new app named MainActivity which is the name of the first activity in the app. The app_name string is set to the name of the app, but it still doesnt work. I figured out changing the title_activity_main to the name of the application fixed the problem with the wrong app name in the app drawer, but that seems like a backwoods kind of way to fix that. Anyone else experience that problem, or just hating the new ADT like me?

Manifest Code

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

<uses-sdk
    android:minSdkVersion="4"
    android:targetSdkVersion="15" />

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name">
    <activity
        android:name=".MainActivity"
        android:label="@string/title_activity_main" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

Charles
  • 48,924
  • 13
  • 96
  • 136
Shaun
  • 5,293
  • 10
  • 37
  • 48
  • Can you post your manifest code? – BlackHatSamurai Aug 23 '12 at 03:32
  • @Shaun : Get used to it - they moved the goalposts. It's how the new ADT works. Sorry, no offence meant but I discovered various things changed when I upgraded - you'll need to re-read through the various auto-created files when you create a new project to see how they're named - either that or just create everything manually. – Squonk Aug 23 '12 at 03:48
  • I like the idea of change, and I loved the new wizard for creating a new app at first until I saw all that changed on the backend. You would think that when specifing an app name would make it so that the actual app showed up under that name instead of the main activity. Makes no sense why it wouldnt. – Shaun Aug 23 '12 at 12:53
  • Problem solved and detailed here -> [Naming my application in android](http://stackoverflow.com/a/23155350/3420447) – Re MiDa Apr 18 '14 at 13:47

7 Answers7

29

I found the solution for you.. In the manifest file, you are able to set one label for the launcher icon, and another for the activity. The app name is set in the intent filter, like this:

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

Cheers

//Nautious

Anders
  • 1,532
  • 1
  • 20
  • 35
5

Recently i have this problem: can you please try with this:

<activity
    android:name=".MainActivity"
    android:label="@string/app_name" >

or remove android:label from activity

Saifuddin Sarker
  • 841
  • 3
  • 7
  • 26
  • 1
    OK, that worked. Seems odd they would change it around to make the activities label title_activity_main and make it screw up the name of the app. – Shaun Aug 23 '12 at 13:08
3

I am also using the updated adt and having the same problem and finally comes out with the only solution which is as follows

<application
    android:name="GlobalData"
    android:icon="@drawable/hdpi"
    android:label="@string/app_name"
    android:theme="@style/AppTheme">

    <activity android:theme="@android:style/Theme.NoTitleBar"
        android:name=".ApplicationCommence"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>

Here above the in "@string/app_name" having my project name.

Reaz Murshed
  • 21,071
  • 12
  • 69
  • 87
raman
  • 337
  • 3
  • 13
  • 1
    While this didnt really fix the problem, all I had to do was add android:name="TestApp", then remove the label from the activity below. Ran it, and it worked fine. Then I reset the manifest back to what I posted above and it works. So, I think the issue was something in the android config file, and when I switched it around it fixed it there. Very odd problem – Shaun Aug 23 '12 at 12:59
  • So, the only real way of fixing this problem is setting the first activities label to @string/app_name. If this is set to title_activity_main like the new wizard wants, then you will have the problem with the incorrect name. Im going to take this up with Google... – Shaun Aug 23 '12 at 13:07
  • Well, noted the problem with google (not only was the main activity name appearing on the app list, but every activity added after that as well) And they sent me a response saying that it would be fixed in the next ADT release – Shaun Sep 18 '12 at 23:43
  • 1
    Check out the answer by @Nautious – Michał Klimczak Jul 01 '13 at 08:38
0

I was also irritated by this problem, finally found a work around and now I am sure it's a bug in new ADT. I added android:name="name_of_my_app" and changed the android:label="name_of_the_app" and it worked as expected.

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

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="15" />

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    android:name = "Sunflow"
    <activity
        android:name=".MainActivity"
        android:label="Sunflow" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

nitinsh99
  • 3,012
  • 3
  • 37
  • 73
0

I did noticed lots of demo apps come with the name MainActivity, and making importing other projects annoying... but shouldn't "right click project ==> rename" fix the name conflicts?

Kerry
  • 119
  • 1
  • 7
-1

For overcoming this problem, make a habit of giving app name at "Title" which is marked. This will obviously solve your problem.

Anupam
  • 3,632
  • 18
  • 53
  • 87
  • Your answer is not obvious. I do not understand what you mean by giving app name at title. What do you mean? – Shaun Aug 23 '12 at 12:50
-2

Steps for creating new android project from the new ADT:

  1. You enter your application name/package and target SDK version.
  2. On the next view, you choose your app icon.
  3. On the third view, you come across to choose between two activities - blankactivity and masterdetail flow.
  4. On the 4th view, you enter your activity-name, layout-name, and at last field you will notice one field is "Title", in that field enter your App Name, and when you will install the app on the device/emulator you will see your app name through there.

Was that clear?

Anupam
  • 3,632
  • 18
  • 53
  • 87