Error: Default Activity Not Found

2018-12-31 17:39发布

I upgraded IntelliJ Idea 12.0.4 to 12.10.

Now all the modules in my Android project give the error:

Error: Default Activity Not Found

I reverted to 12.0.4 and it works.

Any ideas ?? I think it might be related to some plugins not being installed cause the only other thing could have been a local config but I deleted the configuration folder to confirm and that didn't change anything.

30条回答
长期被迫恋爱
2楼-- · 2018-12-31 18:02

I found this blog that really fixed this issue in my case. It turns out you have to add some sort of intent:

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

It was definitely straightforward. Reference:

https://www.aboutonline.info/2018/08/error-running-app-default-activity-not-found-on-android-with-kotlin.html

查看更多
伤终究还是伤i
3楼-- · 2018-12-31 18:02

just faced this error on android studio 2.1.2. solved by adding MAIN/LAUNCHER intent-filter to default activity in flavour manifest, though filter already was in default activity in default manifest. It even was in merged manifest, but studio can't found it until i duplicated filter in both manifests.

查看更多
公子世无双
4楼-- · 2018-12-31 18:02

I have the same problem in Android Studio 3.3 Canary 3. Project from Android Studio 3.0 stabile version works firstly correctly, than after some cleans/rebuilds it starts showing No Default Activity error. I tried to reinstall this alpha version of Android Studio: error again. But then started it in old stabile Android, and using apk install, and this apk works correctly.

Moreover my project was created with Instant App (base, feature, instant, app subdirectories). I think this Android Studio has some problems with Manifest.xml files separated into this multiple directories.

So I have changed in settings to this: enter image description here

查看更多
看风景的人
5楼-- · 2018-12-31 18:03
  1. Build -> Rebuild Project
  2. File -> Invalidate Caches.. -> Invalidate and restart

It works for me. Rebuild project to make sure that no errors in project. Then we can invalidate cache.

查看更多
临风纵饮
6楼-- · 2018-12-31 18:03

In my case File -> Invalidate Caches / Restart... didn't help

Everything was ok with my project and of course I had next intent filter for my activity

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

What really helped me is deleting Android/Gradle cache folders (they can grow up to 10-30 GB)

Go to C:\Users\YOUR_USER_WINDOWS_NAMEand delete next folders

  • .android
  • .AndroidStudio3.2
  • .gradle

(you may save some Android configs from .AndroidStudio3.2 before deleting it if you want it)

You can create bat file CLEAR_CACHE.cmd like this to delete folders without Recycle Bin

rmdir /S /Q .android
rmdir /S /Q .AndroidStudio3.2
rmdir /S /Q .gradle

it would work much faster and you don't have to delete it also from Recycle Bin

p.s. put CLEAR_CACHE.cmd into C:\Users\YOUR_USER_WINDOWS_NAME

it's also a good idea to delete Android Studio folder and download it again

查看更多
琉璃瓶的回忆
7楼-- · 2018-12-31 18:06

Sometimes uninstalling the app for all users helps. Go to Application list in settings go to your app or scroll till the end of the list, then uninstall it. Hope this helps

查看更多
登录 后发表回答