Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/209.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 包中不存在Receiver类_Android_Broadcastreceiver_Package Managers - Fatal编程技术网

Android 包中不存在Receiver类

Android 包中不存在Receiver类,android,broadcastreceiver,package-managers,Android,Broadcastreceiver,Package Managers,我正在尝试实现AlarmManager,以便在2秒钟后重复调用服务请求以获取附近用户信息,如果有可用的用户,则发送通知 SampleAlarmReceiver.java AndroidManifest.xml 请检查您的SampleBootReceiver是否在“com.shayer.samebirthday.alarm”包下。如果不可用,请将SampleBootReceiver类移动到“com.shayer.samebirthday.alarm”包。我也遇到了同样的问题,我做了下面写的事情 1

我正在尝试实现AlarmManager,以便在2秒钟后重复调用服务请求以获取附近用户信息,如果有可用的用户,则发送通知

SampleAlarmReceiver.java AndroidManifest.xml
请检查您的SampleBootReceiver是否在“com.shayer.samebirthday.alarm”包下。如果不可用,请将SampleBootReceiver类移动到“com.shayer.samebirthday.alarm”包。

我也遇到了同样的问题,我做了下面写的事情

1.以下代码行应修复此错误

    <receiver android:name=".alarm.SampleAlarmReceiver"
        android:enabled="false">
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
        </intent-filter>
    </receiver>

二,。在SampleAlarmReceiver.java类中,给出完整的类路径

    ComponentName receiver = new ComponentName(context, <SampleBootReceiver full path>.class)
ComponentName接收器=新组件名(上下文,.class)

我检查了所有这些东西,但仍然发现上面的错误@Raghu Rami Reddy
03-11 16:59:57.328  32279-32279/com.shayer.samebirthday E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.shayer.samebirthday, PID: 32279
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.shayer.samebirthday/com.shayer.samebirthday.activites.MainActivity}: java.lang.IllegalArgumentException: Component class com.shayer.samebirthday.alarm.SampleBootReceiver does not exist in com.shayer.samebirthday
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2521)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2595)
            at android.app.ActivityThread.access$800(ActivityThread.java:178)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1470)
            at android.os.Handler.dispatchMessage(Handler.java:111)
            at android.os.Looper.loop(Looper.java:194)
            at android.app.ActivityThread.main(ActivityThread.java:5624)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
     Caused by: java.lang.IllegalArgumentException: Component class com.shayer.samebirthday.alarm.SampleBootReceiver does not exist in com.shayer.samebirthday
            at android.os.Parcel.readException(Parcel.java:1550)
            at android.os.Parcel.readException(Parcel.java:1499)
            at android.content.pm.IPackageManager$Stub$Proxy.setComponentEnabledSetting(IPackageManager.java:3414)
            at android.app.ApplicationPackageManager.setComponentEnabledSetting(ApplicationPackageManager.java:1500)
            at com.shayer.samebirthday.alarm.SampleAlarmReceiver.setAlarm(SampleAlarmReceiver.java:55)
            at com.shayer.samebirthday.activites.MainActivity.onCreate(MainActivity.java:42)
            at android.app.Activity.performCreate(Activity.java:6092)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1112)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2468)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2595)
            at android.app.ActivityThread.access$800(ActivityThread.java:178)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1470)
            at android.os.Handler.dispatchMessage(Handler.java:111)
            at android.os.Looper.loop(Looper.java:194)
            at android.app.ActivityThread.main(ActivityThread.java:5624)
            at java.lang.reflect.Method.invoke(Native Method)
    <receiver android:name=".alarm.SampleAlarmReceiver"
        android:enabled="false">
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
        </intent-filter>
    </receiver>
    ComponentName receiver = new ComponentName(context, <SampleBootReceiver full path>.class)