20

So like everyone else, I moved to Android Studio and encountered issues.

My current issue - Android Studio won't let me run an application without a launch-able activity in the Manifest, for example, my application Pro key which isn't suppose to be launch-able and runs great with Eclipse.

Obviously it's not suppose to run but is there any way to install it directly from Studio?

Ahmad Aghazadeh
  • 16,571
  • 12
  • 101
  • 98
Lior Iluz
  • 26,213
  • 16
  • 65
  • 114
  • 1
    Have you checked the launch configurations settings? You should be able to declare that you don't want to start an Activity. – nhaarman May 16 '13 at 21:09
  • @Niek it wouldn't let me to even select "Do not launch Activity" on the auto-generated project launch configuration but I added a new "Android Application" and now it works. You should answer so I can accept it. Thanks! – Lior Iluz May 17 '13 at 07:26

4 Answers4

33

In Run/Debug Configurations (just next to the launch button in the toolbar) you can manage your application configurations. There you should be able to specify whether you want to launch an Activity or not.

nhaarman
  • 98,571
  • 55
  • 246
  • 278
  • It is strange, but with my last Android Studio when I install and launch from Android Studio, my `BrodcastReceiver` via BOOT_COMPLETED action, is reached, but via `./gradlew installDebug`, the `BroadcastReceiver` is never reached. Full question: https://stackoverflow.com/questions/44895636/gradle-fails-vs-android-studio-for-a-headless-app-service-without-icon-launcher – Hpsaturn Jul 04 '17 at 01:26
32

In Run/Debug Configurations in General -> Launch Options -> Launch select Nothing like this
enter image description here

Ahmad Aghazadeh
  • 16,571
  • 12
  • 101
  • 98
4

For the case you mention, editing the 'Defaults' run configuration may not result in a runnable/installable app (at Android Studio 0.2.3, at least).

Instead, it is possible to run/install by defining a new run configuration:

Run -> Edit Configurations -> '+'

Select 'Do not launch Activity', but leave 'Deploy application' selected.

BryceCicada
  • 265
  • 2
  • 7
1

Desired Android App Module > LaunchOptions > Launch -> Nothing instead of (Activity)

erluxman
  • 18,155
  • 20
  • 92
  • 126