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:18

Nothing above helped me. After some time I found that IDEA changed action names to uppercase. Like:

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

After reverting to normal, IDEA recognizes default activity:

<intent-filter>
  <action android:name="android.intent.action.MAIN" />
  <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
查看更多
看风景的人
3楼-- · 2018-12-31 18:18

my experience: make sure that all your java file has been indentify,if IDEA not indentify your java file ,so he not able to understand what's "Activity" means

good luck :)

enter image description here

查看更多
初与友歌
4楼-- · 2018-12-31 18:19

Android Manifest.xml set the starting activity like following

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

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
查看更多
看风景的人
5楼-- · 2018-12-31 18:20

in my case i refactored a member variable that was named "activity", i renamed it to "context" ... i found out that the refactor was made to the activity tags in manifest, and i found them context tags instead ... this is really stupid from Android Studio !!

查看更多
怪性笑人.
6楼-- · 2018-12-31 18:20

I was facing similar issue recently. The issue was with activitymanifest xml file. please check if taglines are closed properly.

查看更多
人气声优
7楼-- · 2018-12-31 18:20

I've encountered the same issue. For some reasons, android Studio replaced all the android:name attributes in most of XML files, including the manifest, to android:subject which isn't recognized by Android Studio.

enter image description here

As you can see in the picture above the IDE doesn't recognize the android:subject attribute. As a result, it won't be able to read the lines which specify the MainActivty.

The solution is simply to change every android:subject to android:name and then Rebuild the project from Build menu -> Rebuild Project. You might encounter the same issue when rebuilding the project, so do the same as above.

查看更多
登录 后发表回答