1

I just installed Android Studio 0.6.1 and imported a project from Eclipse. When I tried to run the project, I got Error: Default Activity not found.

I looked at these two StackOverflow questions:

As suggested, I tried to invalidate the caches + restart and make sure my AndroidManifest was correct. Both didn't work.

I also tried this solution, but to no avail:

Try to right click on the project and choose Open Module Settings. Then go to the Sources tab in your module, find the src folder, right click on it and mark it as Sources (blue color).

When I opened the module settings, there was no sources tab.

How can I fix this problem?
Is there there any equivalent of the sources tab in Android Studio 0.6.1?

Edit:

Here's the launcher activity

<activity
    android:name="com.lschlessinger.appname.activities.SplashScreenActivity"
    android:noHistory="true" >
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

I also tried cleaning my project, rebuilding my project, and restarting Android Studio, all of which, did not resolve the problem.

As a temporary solution, I'm manually selecting the launcher activity in the run configuration.

Community
  • 1
  • 1
lschlessinger
  • 1,934
  • 3
  • 25
  • 47

6 Answers6

3

I encountered the same question. Finally I resolved the question.

My Manifest file is like this:

        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.DEFAULT" />

and it should be:

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

In the worst, if it cannot resolve you question, you can create a new activity and select as Launcher activity to see whether it's resolved.

It seems that you don't have any default activity. Create a new activity by File -> New ->Activity and select as Launcher activity.

mbo
  • 164
  • 8
0

Switch to Android Studio 0.8.+.

This fixed the issue.

lschlessinger
  • 1,934
  • 3
  • 25
  • 47
  • @Ischlenssinger I'm having the same issue with AS 0.8.7. Any other tip? – MatheusJardimB Aug 26 '14 at 22:46
  • I'm not really sure because I have AS 0.8.6 and didn't have to do anything special when I updated AS, but here's a few things you could do (if you haven't already): clean project then rebuild it, then restart AS. Double check your Manifest for errors. Invalidate caches and restart AS. If all that didn't work, then in the interim, just edit your run configuration to manually start your launcher activity. Hope that helps! – lschlessinger Aug 27 '14 at 04:11
0

In my case it was a third-party library with invalid Manifest which defined another main activity. As you know, Gradle combines Manifests, so my application contained two main activities. When I fixed library Manifest this error also gone.

Andrey Novikov
  • 5,563
  • 5
  • 30
  • 51
0

***************Simple Solutution**********************

This problem occurs because of caches. If You are using Android Studio. File---->Invalidate Caches/Restart. Click on it and choose Invalidate Caches/Restart.

mohit sharma
  • 1,050
  • 10
  • 20
-1

Perhads Build-> Clean Project, then Build-> Rebuild Project, then restart AS. source

Blake G
  • 581
  • 7
  • 24
  • I would just move on if things are hackily working. Android Studio is in beta, and deservingly so, its really buggy. Maybe take a day off from it and come back later... that can help a lot. – Blake G Jun 27 '14 at 03:09
  • Yeah, It's not really a big problem. I was just hoping there was a quick fix. I don't plan on changing my default activity anytime soon, so this won't really matter and it works fine. Thanks for your help. – lschlessinger Jun 27 '14 at 03:12
-1

It seems that you don't have any default activity. Create a new activity by File -> New ->Activity and select as Launcher activity.

That should work.

Suhail Bhat
  • 443
  • 4
  • 13