我把IntelliJ IDEA从12.0.4升级到12.10。
现在我的Android项目中的所有模块都给出了错误:
错误:没有找到默认活动
我恢复到12.0.4,一切都恢复正常了。
什么好主意吗?我认为这可能是一个丢失插件的问题。由于插件没有安装,它无法找到默认活动。另一个东西可能是本地配置,但我对此表示怀疑。我删除了配置文件夹来验证,这没有改变任何东西。
我把IntelliJ IDEA从12.0.4升级到12.10。
现在我的Android项目中的所有模块都给出了错误:
错误:没有找到默认活动
我恢复到12.0.4,一切都恢复正常了。
什么好主意吗?我认为这可能是一个丢失插件的问题。由于插件没有安装,它无法找到默认活动。另一个东西可能是本地配置,但我对此表示怀疑。我删除了配置文件夹来验证,这没有改变任何东西。
当前回答
在配置新项目时
公司名称应该以.app结尾。例如,它应该是android.example.com.app 它不应该是android.example.com。
其他回答
去建造。Gradle(项目:xyz)
buildscript {
repositories {
jcenter()
google()
}
allprojects {
repositories {
jcenter()
google()
}
// Just place 'google()' to the top of 'jcenter()'
buildscript {
repositories {
google()
jcenter()
}
allprojects {
repositories {
google()
jcenter()
// enter code here
}
}
它非常适合我。
我将Intent-filter改为
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
只需要添加DEFAULT选项。我正在使用Process Phoenix库,它提示我定义一个默认意图。这就解决了我的问题。
错误:没有找到默认活动
我是这样解决的:
运行→编辑配置→Android应用程序→*在“启动”编辑框中输入默认活动类的路径。
尝试右键单击项目并选择打开模块设置。然后转到模块中的Sources选项卡,找到src文件夹,右键单击并将其标记为Sources(蓝色)。
在Android Studio的后期版本中没有源代码选项卡,但您可以编辑构建。如何在Android Studio中添加一个链接源文件夹?
在我的案例中,AndroidManifest.xml中有一个打印错误,如下所示。删除应用程序标签上方的“o”字母就解决了这个问题。
显然,Android Studio不会检测AndroidMainfest.xml中的类型错误
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
o
<application android:name=".AppName"
android:allowBackup="false"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.Light.NoTitleBar">