简体   繁体   English

切换到另一个活动时出错,无法找到明确的活动类,您是否在 AndroidManifest 中声明了此活动

[英]Error when switching to another Activity unable to find explicit activity class have you declared this activity in your AndroidManifest

In my project there are two modules of the application.在我的项目中有两个应用程序模块。 When I try to use Intent to go from the Activity of one module to the Activity of another module I get an error that the second Activity is not found in the Manifest.当我尝试使用 Intent 从一个模块的 Activity 转到另一个模块的 Activity 时,我收到一个错误,即在 Manifest 中找不到第二个 Activity。 But this Activity is registered in the Manifest of the second module.但是这个Activity注册在第二个模块的Manifest中。 I have already tried all the answers from similar questions, but the problem remains我已经尝试了类似问题的所有答案,但问题仍然存在

My Intent function:我的意图功能:

public void SendToMetronomeActivity() {
        Intent mMetronomeIntent = new Intent();
        mMetronomeIntent.setClassName("com.infernal93.metronome.activities", "MainMetronomeActivity");
        startActivity(mMetronomeIntent);
    }

Manifest of the second module:第二个模块的清单:

<activity android:name="com.infernal93.metronome.activities.MainMetronomeActivity"
            android:hardwareAccelerated="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

        </activity>

Error:错误:

E/InputEventReceiver: Exception dispatching input event.
E/MessageQueue-JNI: Exception in MessageQueue callback: handleReceiveCallback
E/MessageQueue-JNI: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.infernal93.metronome.activities/MainMetronomeActivity}; have you declared this activity in your AndroidManifest.xml?
        at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1801)
        at android.app.Instrumentation.execStartActivity(Instrumentation.java:1514)
        at android.app.Activity.startActivityForResult(Activity.java:4028)
        at androidx.fragment.app.j.startActivityForResult(FragmentActivity.java:676)
        at android.app.Activity.startActivityForResult(Activity.java:3989)
        at androidx.fragment.app.j.startActivityForResult(FragmentActivity.java:663)
        at android.app.Activity.startActivity(Activity.java:4312)
        at android.app.Activity.startActivity(Activity.java:4280)
        at com.mib.livepartiture.Live.MainActivity.y(MainActivity.java:1356)

New error:新错误:

E/InputEventReceiver: Exception dispatching input event.
E/MessageQueue-JNI: Exception in MessageQueue callback: handleReceiveCallback
E/MessageQueue-JNI: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.infernal93.metronome.activities.MainMetronomeActivity }

declare your activity like this:像这样声明您的活动:

<activity
        android:name=".MainMetronomeActivity"
        android:label="Preferences" >
        <intent-filter>
            <action android:name="com.infernal93.metronome.activities.MainMetronomeActivity />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

and use it:并使用它:

Intent i = new Intent("com.infernal93.metronome.activities.MainMetronomeActivity");

暂无
暂无

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

相关问题 无法找到明确的活动类,是否已在AndroidManifest.xml中声明了该活动? - Unable to find explicit activity class have you declared this activity in your AndroidManifest.xml? 屏幕锁定导致无法找到明确的活动类,您是否已在AndroidManifest.xml中声明了该活动? - Screen Locked causing Unable to find explicit activity class have you declared this activity in your AndroidManifest.xml? 无法找到显式活动类 {}; 您是否在 AndroidManifest.xml 中声明了此活动 - Unable to find explicit activity class {}; have you declared this activity in your AndroidManifest.xml 无法找到显式活动 class {}; 你有没有在你的 AndroidManifest.xml 地图中声明这个活动 API 不工作g;(Java ZE846DZDBC9AB870 - Unable to find explicit activity class {}; have you declared this activity in your AndroidManifest.xml Maps API not workingg ;( Java Android Studio? android.content.ActivityNotFoundException:无法找到显式活动 class {您是否在 AndroidManifest.xml 中声明了此活动? - android.content.ActivityNotFoundException: Unable to find explicit activity class { have you declared this activity in your AndroidManifest.xml? android.content.ActivityNotFoundException:无法找到显式活动类; 您是否在 AndroidManifest.xml 中声明了此活动? - android.content.ActivityNotFoundException: Unable to find explicit activity class; have you declared this activity in your AndroidManifest.xml? 错误:您是否在 AndroidManifest.xml 中声明了此活动? 当试图意图上课时 - Error: have you declared this activity in your AndroidManifest.xml? when trying to intent a class ActivityNotFoundException:无法找到显式活动类GoogleDriveProxeyActivity是否已声明此内容 - ActivityNotFoundException: Unable to find explicit activity class GoogleDriveProxeyActivity have you declared this 错误您是否在 AndroidManifest.xml 中声明了此活动? - Error have you declared this activity in your AndroidManifest.xml? Android Studio:无法找到显式活动 class 但活动已在 AndroidManifest.xml 中声明 - Android Studio: Unable to find explicit activity class but activity already declared in AndroidManifest.xml
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM