简体   繁体   English

“无法识别启动活动:未找到默认活动” - Android Studio - 没有答案工作

[英]"Could not identify launch activity: Default Activity not found" - Android Studio - no answers working

Whenever trying to run the app, getting the error:每当尝试运行应用程序时,都会出现错误:

"Could not identify launch activity: Default Activity not found". “无法识别启动活动:未找到默认活动”。

I have seen a few other threads on the same issue, but the below solutions have not worked for me:我在同一问题上看到了其他一些线程,但以下解决方案对我不起作用:

  1. Invalidating gradle cache and re-running使gradle缓存无效并重新运行
  2. Manually overriding in the edit configuration tab to select the default activity (it then says "The activity 'MainActivity' is not declared in AndroidManifest.xml" even though it is!)在编辑配置选项卡中手动覆盖以选择默认活动(然后显示“AndroidManifest.xml 中未声明活动'MainActivity'”,即使它是!)
  3. Re-syncing the gradle files重新同步 gradle 文件
  4. Literally shuffling around the order of the activities in my manifest从字面上改变我清单中活动的顺序
  5. Using the long name for my activities, but doesn't make any difference为我的活动使用长名称,但没有任何区别
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.mywebname">

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

    <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"
            android:screenOrientation="portrait"
            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=".ListenScreen"
            android:parentActivityName=".MainActivity"
            android:screenOrientation="portrait">
        </activity>

 </application>

</manifest>
```

As you can see, I have clearly declared the activities (my app only has 2 so far), and I've put the intents around the ".MainActivity".

This answer worked for me after trying so many other tweaks, just adding the package name solved my problems在尝试了许多其他调整之后,这个答案对我有用,只需添加包名称就解决了我的问题

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.name">

https://stackoverflow.com/a/72300233/8720836 https://stackoverflow.com/a/72300233/8720836

您只需在清单标签中添加包名称即可在 app.gradle 文件中找到您的包名称,一切顺利

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android Automotive:无法识别启动活动:未找到默认活动 - Android Automotive: Could not identify launch activity: Default Activity not found 无法识别启动活动:未找到默认活动 - Could not identify launch Activity: Default Activity not found 无法识别启动活动:升级到 Android Studio 4.0 后未找到默认活动 - Could not identify launch activity: Default Activity not found after upgrading to Android Studio 4.0 在构建Kotlin项目时,Android Studio报告“无法识别启动活动:找不到默认活动” - Android Studio reports “Could not identify launch activity: Default Activity not found” when building Kotlin projects 无法识别启动活动:未找到默认活动 - Could not identify launch Activity: Default Activity wasn't found 自定义键盘-无法识别启动活动:找不到默认活动 - Custom Keyboard - Could not identify launch activity: Default Activity not found 我经常发现此特定错误:“无法识别启动活动:找不到默认活动启动活动时出错” - I often found this specific error: “Could not identify launch activity: Default Activity not found Error while Launching activity” 无法识别启动活动:找不到默认活动启动活动时出错 - Could not identify launch activity: Default Activity not found Error while Launching activity 无法识别启动活动,未找到默认活动启动活动时出错 - Could not identify launch activity , Default Activity not found Error while Launching activity 运行项目时出现错误(无法识别启动活动:未找到默认活动) - Getting Error(Could not identify launch activity: Default Activity not found) While running project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM