问题描述
我尝试使缓存无效并重新启动,但是问题仍然存在,这是AndroidManifest.xml的代码 我正在使用Android Studio版本4,当我尝试运行我的APP时,我收到一条消息::Error,Default Activity not found,请帮助我如何解决此问题
SELECT hes.CompletedDate,eve.PeriodDays,eve.PeriodMonths,eve.PeriodYears,CASE
WHEN eve.PeriodDays IS NOT NULL THEN DATEADD(day,hes.CompletedDate)
WHEN eve.PeriodMonths IS NOT NULL THEN DATEADD(month,hes.CompletedDate)
WHEN eve.PeriodYears IS NOT NULL THEN DATEADD(year,hes.CompletedDate)
END renewaldate
FROM dbo.EventScheduled hes LEFT JOIN requiredEvents eve
ON hes.ID = eve.ID
下面是MainActivity发生错误的地方
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.megatechnologyteam.megavidi">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity"></activity>
<activity android:name=".SplashActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
什么是问题,我该如何解决
解决方法
如果您得到的错误是Default Activity not found
,则表明您的AndroidManifest.xml
设置不正确。
要做的事情:
- 确保
SplashActivity
和MainActivity
存在; - 为您的活动指定完整的软件包名称。例如,
android:name=".MainActivity"
可以代替android:name="com.app.package.MainActivity"
; - 如果
SplashActivity
不存在,请尝试对清单进行下一个配置:
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
如果清单的设置正确,并且确定“活动”存在,则尝试使缓存无效并重新启动Android Studio:
File -> Invalidate Caches / Restart
或按两下Shift键并输入invalidate caches
,然后选择第一个选项。