Android studio Android Studio错误类型3:启动活动时出错

Android studio Android Studio错误类型3:启动活动时出错,android-studio,Android Studio,我是android开发的新手,有时我真的觉得这一切都很混乱和混乱。我正在运行我的项目,在复制一个活动并更改包名之前工作正常。我关闭了安卓工作室。现在,当我再次打开我的项目时,我开始收到错误“启动时出错::找不到默认活动”,但我在AndroidManifest.xml中找到了它。然后我尝试了“编辑配置->常规->启动应用程序”并将其设置为Splashscreen。现在我遇到了一个新错误,这个错误太顽固了,无法消失!我尝试了所有方法,但没有任何效果。请帮助我,我可能错过了一些愚蠢的东西 $ adb

我是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
我所尝试的:

  • 清理项目和重建
  • 卸载应用程序,断开手机连接并重新连接以重新构建
  • 删除.idea/workspace.xml
  • 在gradle构建中添加应用程序id=“打包名称”
  • 将android:name=“.Splashscreen”更改为android:name=“com.example.dell.optasiaapp.Splashscreen”
  • 文件->使缓存无效/重新启动
我的AndroidManifest代码是

<?xml version="1.0" encoding="utf-8"?>



如果手动更改程序包名称,请尝试以下操作: 内建渐变 应用插件:“android库” 到
apply plugin:'com.android.application'

这太愚蠢了。我尝试了互联网上所有可用的东西,但都不管用。所以我只是做了一个新项目,将所有代码复制粘贴到新的空活动中。现在运行良好。

这是我在android Studio中遇到的最糟糕的事情之一

遵循以下步骤:

  • 关闭你的Android Studio

  • Delete.idea/workspace.xml

  • 启动Android Studio并启动您的应用程序


  • 我也遇到了同样的问题,模仿这个应用程序并在其他手机上试用,效果很好,但我的手机却失败了

    对我来说,删除所有其他用户配置文件是可行的,包括来宾用户

    <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>