简体   繁体   中英

Android Studio Error running 'app': Default Activity not found

I am using Android Studio 3.4.2 on macOS 10.14.5. 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

   <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

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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