Android 当试图通过侧面导航使用意图启动活动时,应用程序崩溃
请在我单击导航项开始活动时,我的应用程序崩溃。在过去的6个小时里,我尝试了类似问题的所有解决方案,但都没有成功。这包括在清单中注册活动,更改意图Android 当试图通过侧面导航使用意图启动活动时,应用程序崩溃,android,android-intent,permissions,manifest,Android,Android Intent,Permissions,Manifest,请在我单击导航项开始活动时,我的应用程序崩溃。在过去的6个小时里,我尝试了类似问题的所有解决方案,但都没有成功。这包括在清单中注册活动,更改意图(此菜单为profile.class)到(mainactivity.this,menu\u profile.class)到`(getApplicationContext(),菜单_profile.class);。谷歌权限(13)错误无法解决 片段 else if (itemId == R.id.third) { I
(此菜单为profile.class)代码>到(mainactivity.this,menu\u profile.class)代码>到`(getApplicationContext(),菜单_profile.class);。谷歌权限(13)错误无法解决
片段
else if (itemId == R.id.third) {
Intent intent = new Intent(getApplicationContext(), Menu_Profile.class);
startActivity(intent);
}
显示
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.majesty.adesanmi.viewpager_nav">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
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=".Menu_Profile"
android:label="DestinationActivity"/>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</application>
</manifest>
只需从菜单profilr活动中删除意图过滤器,或将其从Manifist文件中删除或替换即可
<?xml version="1.0" encoding="utf-8"?>
在AndroidMenifest.xml中声明Menu Profile.class是否使用Instant Run?检查我的ans my Friends日志的第四行显示您有一个ActivityNotFoundException
:`无法找到显式活动类{com.smiture.adesanmi.viewpager\u nav/com.smiture.adesanmi.viewpager\u nav.Menu关于};您是否在AndroidManifest.xml中声明了此活动?`因此,它似乎在寻找活动Menu\u About
而不是Menu\u Profile
是
<?xml version="1.0" encoding="utf-8"?>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
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=".Menu_Profile"
android:label="DestinationActivity"/>
</application>