我是 android 开发的新手,我真的觉得它有时很困惑和令人困惑。我正在运行我的项目,该项目在此之前运行良好,然后复制了一个事件并更改了运行良好的包名称。我关闭了android工作室。现在,当我再次打开我的项目时,我开始收到错误“启动时出错::未找到默认事件”,但我在 AndroidManifest.xml 中有它。然后我尝试了“编辑配置->常规->启动应用程序并将其设置为Splashscreen。现在我遇到了这个新错误,它太顽固而无法消失!我已经尝试了所有方法,但没有任何效果对我有用。请帮助我可能错过了一些愚蠢的东西。
$ adb shell am start -n"com.example.dell.optasiaapp/com.example.dell.optasiaapp.Splashscreen" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Error while executing: am start -n "com.example.dell.optasiaapp/com.example.dell.optasiaapp.Splashscreen" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat= [android.intent.category.LAUNCHER] cmp=com.example.dell.optasiaapp/.Splashscreen }
Error type 3
Error: Activity class {com.example.dell.optasiaapp/com.example.dell.optasiaapp.Splashscreen} does not exist.
Error while Launching activity
我尝试过的:
我的 AndroidManifest 代码是
<?xml version="1.0" encoding="utf-8"?>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme"></application>
<activity android:name=".Splashscreen"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".HomeScreen">
<intent-filter>
<action android:name="com.example.dell.optasiaapp.HomeScreen" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity android:name=".AboutUs">
<intent-filter>
<action android:name="com.example.dell.optasiaapp.AboutUs" />
<category android:name="android.intent.category.About" />
</intent-filter>
</activity>
<activity android:name=".Help" > </activity>
最佳答案
这太愚蠢了。我尝试了 Internet 上可用的所有内容,但没有任何效果。所以我刚刚创建了一个新项目并将所有代码复制粘贴到新的空事件中。它现在运行良好。
关于android-studio - Android Studio 错误类型 3 : Error while Launching activity,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/39021230/