当前位置: 首页 > 知识库问答 >
问题:

默认活动未找到错误Android Studio

卢光远
2023-03-14
<intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name = "android.intent.category.LAUNCHER" />
</intent-filter>
File -> Invalidate Caches / Restart...

但仍然不起作用。下面是我的Android Manifest.xml文件。我想用名为“.main2activity”的活动启动我的应用程序。还要注意,出于某种原因,我的.xml文件在设计模式下显示为黑色背景,而且奇怪地不同。

<?xml version="1.0" encoding="utf-8"?>
<!--
     The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
     Google Maps Android API v2, but you must specify either coarse or fine
     location permissions for the 'MyLocation' functionality. 
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <uses-feature
        android:name="android.hardware.camera"
        android:required="true" />

    <activity android:name=".MainActivity" />
    </activity>


    <activity android:name=".Dining" />
    <activity android:name=".SignUp" />

    <provider
        android:name="android.s


        upport.v4.content.FileProvider"
        android:authorities="com.example.android.fileprovider"
        android:exported="false"
        android:grantUriPermissions="true">
        <meta-data
            android:name="android.support.FILE_PROVIDER_PATHS"
            android:resource="@layout/file_paths" />
    </provider>
    <!--
         The API key for Google Maps-based APIs is defined as a string resource.
         (See the file "res/values/google_maps_api.xml").
         Note that the API key is linked to the encryption key used to sign the APK.
         You need a different API key for each encryption key, including the release key that is used to
         sign the APK for publishing.
         You can define the keys for the debug and release targets in src/debug/ and src/release/. 
    -->
    <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="AIzaSyD37TQWZ02Re5_3lTH-kL17cOOVQw1B8dY" />

    <activity>
        android:name=".MapsActivity"
        android:label="@string/title_activity_maps" />


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

    <activity android:name=".MapsMain"></activity>
</application>

共有1个答案

堵才哲
2023-03-14
<activity>
        android:name=".MapsActivity"
        android:label="@string/title_activity_maps" />
<activity
        android:name=".MapsActivity"
        android:label="@string/title_activity_maps" />
 类似资料:
  • 作为一个android工作室的新手,我不知道如何阻止这个错误,即使查看其他帖子。我不明白如何在清单中添加活动。这是我的舱单:

  • 我刚刚安装了Android Studio0.6.1并从Eclipse导入了一个项目。当我尝试运行项目时,我得到。 我研究了这两个StackOverflow问题: 在Android Studio中找不到默认活动 按照建议,我尝试使缓存无效+重新启动,并确保我的是正确的。两个都不起作用。 我也尝试过这个解决方案,但没有效果: 如何修复这个问题? 在Android Studio0.6.1中是否有与sou

  • 最近我更新了我的android studio到3.2,但当旧的打开项目时,我得到错误“缺省活动找不到”。

  • 这似乎是明显的合并错误。我正在尝试将现有代码移植到即时应用程序模块。我所尝试的是: > 已将主应用程序模块更改为BaseFeatuRemodule。 创建了新模块CompleteApp。 清空了CompleteAppModule的清单: 我试过重建/无效缓存和重新启动/重新启动studio,但没有帮助。有谁能帮我一下吗?

  • 我有两个单独的应用程序。 第一个发送两种不同的广播。 第二个等待来自App#1的这个广播,并使用广播来决定发起什么活动。 但是,如果App#2中没有定义默认活动,它将无法运行并抛出: 运行应用程序时出错:找不到默认活动 但是,如果我确实在清单文件中定义了一个,那么这就违背了广播的目的。 正如@lemi Miles所建议的,我们只需在启动选项上转到App>Edit Configurations>并选

  • 自从在macOS上升级到Android Studio4.0后,我一直有这个问题。当我试图从Android Studio启动我的应用程序时,我会得到以下错误: 我的项目有一点独特之处在于,默认活动是在我的项目使用的另一个库的清单中定义的,而不是项目本身。在升级之前,这一切都很好,但现在不适合我。当我打开包含依赖项的项目时,它可以正常构建和运行。我已经尝试了以下步骤: 清理项目,重建 使缓存无效并重新