简体   繁体   English

Android Studio运行“ app”时出错:找不到默认活动

[英]Android Studio Error running 'app': Default Activity not found

I am using Android Studio 3.4.2 on macOS 10.14.5. 我在macOS 10.14.5上使用Android Studio 3.4.2。 Every time I try to run my app, I get the following error: 每次尝试运行我的应用程序时,都会出现以下错误:

Error running 'app': Default Activity not found

I tried this solution already ( Error: Default Activity Not Found ) but it didn't help. 我已经尝试过此解决方案( 错误:未找到默认活动 ),但没有帮助。

Any help? 有什么帮助吗?

If Invalidate Caches/Restart did not help you, then maybe you forget to declare Your Activity in Manifest 如果Invalidate Caches/Restart对您没有帮助,那么也许您忘记在清单中声明您的活动了

   <activity android:name="your.package.YourDefaultActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>

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

Try to add this into your manifest, This lines of code tell the system from which activity Application should start, like an entering point of your app 尝试将其添加到清单中,这行代码告诉系统应用程序应从哪个活动开始,就像应用程序的输入点一样

Make sure you register your default activity 确保您注册了默认活动

 <activity
        android:name="org.cocos2dx.cpp.AppActivity"
        android:screenOrientation="portrait"
        android:configChanges="orientation|keyboardHidden|screenSize"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
        android:launchMode="singleTask"
        android:taskAffinity=""  >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

Also make sure your selected module & default activity is correct 还要确保您选择的模块和默认活动正确

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM