1

I've build apk and after install no icon in launcher. App works correctly and i can start activity with adb. But why app no icon in launcher i can't understand.

<?xml version="1.0" encoding="utf-8"?>  
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    .....skiped....
    <application
        android:name="DialerApplication"
        android:label="@string/applicationLabel"
        android:icon="@mipmap/ic_launcher_phone"
        android:hardwareAccelerated="true"
        android:supportsRtl="true"
        android:backupAgent='com.android.dialer.DialerBackupAgent'>

        <meta-data android:name="com.google.android.backup.api_key"
            android:value="AEdPqrEAAAAIBXgtCEKQ6W0PXVnW-ZVia2KmlV2AxsTw3GjAeQ" />


        <!-- The entrance point for Phone UI.
             stateAlwaysHidden is set to suppress keyboard show up on
             dialpad screen. -->
        <activity android:name=".DialtactsActivity"
            android:label="@string/launcherActivityLabel"
            android:theme="@style/DialtactsActivityTheme"
            android:launchMode="singleTask"
            android:clearTaskOnLaunch="true"
            android:icon="@mipmap/ic_launcher_phone"
            android:enabled="@*android:bool/config_voice_capable"
            android:windowSoftInputMode="stateAlwaysHidden|adjustNothing">
            ......skiped......
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.LAUNCHER" />
                <category android:name="android.intent.category.BROWSABLE" />
            </intent-filter>
            ......skiped......
        </activity>

    ......skiped..........
    </application>
</manifest>

It seems like i see cause of problem. If i try start my app with adb "adb shell am start mypackagename" i get error:

Activity not started, unable to resolve Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]

But i set in AndroidManifest intent-filter for action android.intent.action.MAIN and category android.intent.category.LAUNCHER.

Why android don't register action and category for main activity?

Link to full AndroidManifest: https://github.com/Anton111111/android_packages_apps_Dialer/blob/cm-12.1_dialer_for_xperia/AndroidManifest.xml

It seems like android full ignores all my intent-filters for activity .DialtactsActivity.

Anggrayudi H
  • 14,977
  • 11
  • 54
  • 87
Anton111111
  • 656
  • 1
  • 7
  • 23
  • and in the mipmap folders you definetly have ic_launcher_phone png icon ?? -- if so you may need to rename it to ic_launcher - probably not accepting anything but ic_launcher -- try that -- and you dont need (android:icon="@mipmap/ic_launcher_phone") in the activity -- just in Application is fine – Tasos Sep 20 '15 at 07:47
  • another hint is that if you are using an emulator there's quite a few icons so there is a 2nd page you can slide with the mouse, You App icon may be on the 2nd page – Tasos Sep 20 '15 at 07:57
  • What device? Is is default launcher? What Android version? Some android versions may not like @mipmap. Try putting the icon into the drawable folder and do @drawable/... – Gunnar Karlsson Sep 20 '15 at 08:46
  • Android version is 5.1.1. Device Xperia ZR. – Anton111111 Sep 20 '15 at 09:10
  • I think that problem not in icon because i have another app with android:icon="@mipmap/ic_contacts_clr_48cv_44dp" and it works correctly and has icon in launcher. And if i go to settings-applications and find my app i see that app has icon. – Anton111111 Sep 20 '15 at 09:12
  • I see cause of problem. If i try start my app with adb "adb shell am start mypackagename" i get error "Activity not started, unable to resolve Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]". But i set in AndroidManifest intent-filter for action android.intent.action.MAIN and category android.intent.category.LAUNCHER. – Anton111111 Sep 20 '15 at 09:19
  • I had the same error removing fixed it for me – user1634451 Feb 17 '16 at 05:17

2 Answers2

0

Define multiple intent filters for their specific purposes:

<activity>
    <intent-filter>
        <!-- This will put the activity in launcher. -->
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>

    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <!-- Include the host attribute if you want your app to respond
             only to URLs with your app's domain. -->
        <data android:scheme="http" android:host="www.example.com" />
        <category android:name="android.intent.category.DEFAULT" />
        <!-- The BROWSABLE category is required to get links from web pages. -->
        <category android:name="android.intent.category.BROWSABLE" />
    </intent-filter>
</activity>

Example taken from https://developer.android.com/guide/components/intents-common.html

Eugen Pechanec
  • 37,669
  • 7
  • 103
  • 124
  • I've already troed make multiple intent filters. It's not solve my problem ;( – Anton111111 Sep 20 '15 at 14:57
  • Assuming the icon and label are non null the only suspicious value is this `@*android:bool/config_voice_capable`. If you set it to `true` is the icon still missing from launcher? – Eugen Pechanec Sep 20 '15 at 14:59
  • You are right. I taked out andoid:enabled from manifest and now i see icon. – Anton111111 Sep 20 '15 at 15:20
  • You can check whether the phone has a GSM module from Java http://stackoverflow.com/questions/6465125/how-to-check-telephony-and-camera-availability-for-sdk-version-5 – Eugen Pechanec Sep 20 '15 at 15:24
0
    <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.DEFAULT"/>
            <category android:name="android.intent.category.LAUNCHER"/>
    </intent-filter>

Make it As

    <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
    </intent-filter>
Rishabh Dhiman
  • 159
  • 2
  • 9