1
我尝试在手机启动时显示简单的烤面包信息。 我浪费了将近一天的时间,试图找出为什么我的代码无法工作。BroadcastReceiver java.lang.ClassNotFoundException
以下是完整的错误:
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>
而我的等级:
namespace Debug
{
class BroadcastReceiverClass:BroadcastReceiver
{
public override void OnReceive (Context context, Intent intent)
{
Toast.MakeText (context,"Work",ToastLength.Short).Show();
}
}
}
在模拟器调试应用程序抛出抛出java.lang.ClassNotFoundException并在重启应用程序崩溃时在手机上。
预先感谢您!
你在用'Xamarin'吗? – giannisf
你在哪里打电话给这个班?我们可以看到那个代码吗? – Rafa
看看这个:https://forums.xamarin.com/discussion/13614/how-do-i-update-my-activity-using-a-broadcastreceiver – Talha