“未找到默认活动"关于 Android Studio 升级 [英] "Default Activity Not Found" on Android Studio upgrade

查看:32
本文介绍了“未找到默认活动"关于 Android Studio 升级的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将 IntelliJ Idea 从 12.0.4 升级到 12.10.

现在我的Android项目中的所有模块都给出错误:

错误:未找到默认活动

我恢复到 12.0.4 并且一切正常.

有什么想法吗?我认为这可能是缺少插件的问题.由于未安装插件,因此无法找到默认活动.另一件事可能是本地配置,但我对此表示怀疑.我删除了配置文件夹进行验证,但没有任何改变.

解决方案

我无法评论为什么升级IntelliJ可能会导致这个问题,因为我不使用它.

但是,该错误:未找到默认活动"似乎在告诉您,您没有在 AndroidManifest.xml 中声明的活动被标记为主要活动,在应用程序启动时启动.

您应该至少有一个类似这样的活动:

MainActivity.javaactivity_main.xml

I upgraded IntelliJ Idea from 12.0.4 to 12.10.

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

Error: Default Activity Not Found

I reverted back to 12.0.4 and it everything works again.

Any ideas? I think it might be an issue with a missing plugin. Since the plugin is not installed, it is not able to find the default activity. Another thing could have been a local config, but I doubt it. I deleted the configuration folder to verify and that didn't change anything.

解决方案

I can't comment on why the upgrade of IntelliJ might cause this problem because I don't use it.

However, that error: "Default Activity Not Found" seems to be telling you that you don't have an activity declared in AndroidManifest.xml that is marked as the main activity, to be launched when the application starts.

You should have at least one activity that looks something like this:

<activity
        android:name="com.your.package.name.YourActivity"
        android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

If you don't have at least one activity with an intent filter like that, you would most likely see the error message you have included here.

You should add that intent filter to the Activity that you wish to open when you start the application, and that should fix your problem.

Edit:

Additional details (AndroidStudio4.1.2) if the project is created as EmptyApplication then the developer must manually create below 3 files to avoid Default Activity Not Found error

AndroidManifest.xml MainActivity.java activity_main.xml

这篇关于“未找到默认活动"关于 Android Studio 升级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆