Android BroadcastReceiver java.lang.ClassNotFoundException
我试着在手机启动时显示一个简单的祝酒词。 我浪费了将近一天的时间试图弄明白为什么我的代码不起作用 以下是全部错误:Android BroadcastReceiver java.lang.ClassNotFoundException,android,android-intent,xamarin,broadcastreceiver,classnotfoundexception,Android,Android Intent,Xamarin,Broadcastreceiver,Classnotfoundexception,我试着在手机启动时显示一个简单的祝酒词。 我浪费了将近一天的时间试图弄明白为什么我的代码不起作用 以下是全部错误: Unable to instantiate receiver com.debug.receivebootcomplete.debug.BroadcastReceiverClass: java.lang.ClassNotFoundException: com.debug.receivebootcomplete.debug.BroadcastReceiverClass 清单文件: &
Unable to instantiate receiver com.debug.receivebootcomplete.debug.BroadcastReceiverClass: java.lang.ClassNotFoundException: com.debug.receivebootcomplete.debug.BroadcastReceiverClass
清单文件:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.debug.receivebootcomplete.debug">
<uses-sdk android:minSdkVersion="10" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application android:allowBackup="true" android:icon="@mipmap/icon" android:label="@string/app_name">
<receiver android:name=".BroadcastReceiverClass" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
</application>
</manifest>
在emulator debug中,当重新启动应用程序崩溃时,应用程序抛出java.lang.ClassNotFoundException并打开手机
提前谢谢你 谢谢@Talha
我的错误是由intent filter标记生成的。我不知道为什么,因为在我看到的每个主题中,每个人都在清单文件中使用该标记
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
因此,我删除它并添加
[广播接收机]
[IntentFilter(新[]{Intent.ActionBootCompleted})]
到BroadcastReceiver类。您正在使用
Xamarin
?您在哪里调用此类?我们能看看代码吗?看看这个:
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>