7

I am creating a live wallpaper in android studio. I do not want any UI besides the wallpaper, so my application contains no activities.

However, when I try to deploy to a device, I get the following error and my wallpaper will not load.

Could not identify launch activity: Default Activity not found
Error while Launching activity

How can I create an application which works that does not have a main activity?

Cameron Martin
  • 5,952
  • 2
  • 40
  • 53
  • Possible duplicate of [How to make Animated Android Live Wallpaper ?](http://stackoverflow.com/questions/9584791/how-to-make-animated-android-live-wallpaper) – GreyBeardedGeek Jun 30 '16 at 15:38
  • @GreyBeardedGeek That isn't a duplicate. The linked tutorial has a main activity which sets the wallpaper. I want to have no main activity. – Cameron Martin Jun 30 '16 at 15:49
  • Why are you reluctant to create a main activity? I don't think it's possible. – kha Jun 30 '16 at 15:56
  • @kha Because I don't need one. It seems odd that I need to create a main activity which does nothing then exits. If I have to I will, but I'm just checking that I actually have to. – Cameron Martin Jun 30 '16 at 16:06

1 Answers1

16

It's perfectly fine to have no activities in your application. The build succeeds, Android Studio only fails when it tries to run it, because it doesn't know what to do.

You need to modify your run configuration. Go to "Run > Edit configurations" and under "Launch options" change "Default Activity" to "Nothing":

enter image description here

Marcin Koziński
  • 10,835
  • 3
  • 47
  • 61