错误类型 3 - 错误:活动类不存在

发布于 2025-01-15 00:08:07 字数 1619 浏览 0 评论 0原文

我知道这是一个重复的问题,但我尝试的任何解决方案都没有解决问题。 真正的问题是,有没有办法在启用活动别名时启动应用程序?我的意思是,我的应用程序具有更改某些用户的图标启动器的功能,我想构建应用程序并在图标更改时启动它,因此启用了活动别名。

这是错误:

Error while executing: am start -n "SplashScreenActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=SplashScreenActivity }
Error type 3
Error: Activity class {SplashScreenActivity} does not exist.
Error while Launching activity
Failed to launch an application on all devices

这是我的清单:

    <activity
        android:name="SplashScreenActivity"
        android:configChanges="orientation|keyboardHidden"
        android:noHistory="true"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.Launcher">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <activity-alias
        android:name="SplashScreenActivityAlias"
        android:icon="@mipmap/ic_launcher_prime"
        android:label="@string/app_name_app"
        android:enabled="false"
        android:targetActivity="SplashScreenActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity-alias>

我看到一些需要卸载应用程序的解决方案,但我想像应用程序通常那样构建和启动。

I know it's a duplicated question but any solution I tried not resolved the problem.
The real question is there's a way to launch the app when the activity alias is enabled? I mean, my app has a feature to change the icon launcher for certain users and I want to build the app and launch it when the icon has changed, so the activity alias is enabled.

here's the error:

Error while executing: am start -n "SplashScreenActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=SplashScreenActivity }
Error type 3
Error: Activity class {SplashScreenActivity} does not exist.
Error while Launching activity
Failed to launch an application on all devices

Here's my manifest:

    <activity
        android:name="SplashScreenActivity"
        android:configChanges="orientation|keyboardHidden"
        android:noHistory="true"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.Launcher">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <activity-alias
        android:name="SplashScreenActivityAlias"
        android:icon="@mipmap/ic_launcher_prime"
        android:label="@string/app_name_app"
        android:enabled="false"
        android:targetActivity="SplashScreenActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity-alias>

I saw some resolutions that I need uninstall the app but I want to just build and launch as the app normally do.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

听风念你 2025-01-22 00:08:07

您还没有完全限定该组件,因此它不知道在哪里可以找到它。您需要为您的 Activity 提供包名称,如下所示:

am start -n "my.package.name/.SplashScreenActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER

注意:我为包使用了“my.package.name”。您需要将其替换为应用程序的包名称,如清单中所示。还要注意“。” SplashScreenActivity 之前的“/”(斜杠)字符后面的(句点、点)字符。

You haven't fully qualified the component, so it doesn't know where to find it. You need to provide the package name for your Activity, like this:

am start -n "my.package.name/.SplashScreenActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER

Note: I have used "my.package.name" for the package. You need to replace that with your app's package name, as you have it in the manifest. Also note the "." (period, dot) character after the "/" (slash) character before SplashScreenActivity.

香橙ぽ 2025-01-22 00:08:07

当尝试创建更改图标启动器的功能时,我遇到了同样的问题。通过使缓存无效然后重构导致问题的活动解决了该问题。在此更改后,应用程序安装成功。

I have same issue when try to create a feature to change the icon launcher. Resolved the issue by invalidate cache and then refactor the activity which cause the issue. After this changes app installed successfully.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文