loloof64
loloof64

Reputation: 5392

Why do I get two shortcuts of my app, with different behaviour for each?

In android studio (1.0.2), I made a android library on its own project : I've just created a new project and changed the build.gradle, replacing apply plugin 'com.android.application' with 'com.android.library' (github repository). So building it I am ending with a .aar file. Notice that I am also trying to use Kotlin language in order to build it.

Then I imported this aar library file into an existing android project of my own (github repository), adding adjustement to the app build.gradle.

Though it works, at least on my android Emulator (x86 image of Jeally Bean api : 4.2.2), I got a strange behaviour :

  1. In the application list, I got two shortcuts for my new application
  2. But also, while a shortcut just starts with the library main activity, the other starts my owner ChessPositionManager activity, and goes immediatly inside the contained FileExplorer activity.

So, is that behaviour of having two different icons with a little different behaviour is explicable ? Can I avoid it and at the same time keep the fact that I am coding the library and my application separately ? (Indeed, a library module can easily be added to any project, but it is still coupled with this project, as far from what I've understood).

Upvotes: 0

Views: 192

Answers (1)

MeetTitan
MeetTitan

Reputation: 3568

I assume that your library file has a manifest declaration making it show up in your launcher. See if your library manifest has:

<intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

If it does that is why its showing up twice, that intent filter signals to android you want it to show up.

Also, I suggest taking a look at http://developer.android.com/guide/components/intents-filters.html

Upvotes: 3

Related Questions