Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/231.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 API 16中的广播接收器IllegalArgumentException_Android_Broadcastreceiver_Illegalargumentexception - Fatal编程技术网

Android API 16中的广播接收器IllegalArgumentException

Android API 16中的广播接收器IllegalArgumentException,android,broadcastreceiver,illegalargumentexception,Android,Broadcastreceiver,Illegalargumentexception,我希望有人能帮我弄清楚这件事。我有这段代码可以很好地与API版本10配合使用。然而,当我切换到API16时,第一个组件被加载,但第二个组件抛出一个异常——它在应用程序中不存在 除了API的更改外,没有任何更改。有人能解释一下吗? 我一直在寻找,还没有发现任何东西 谢谢 /*************************************************** * INITIATE THE BROADCAST RECEIVERS ************

我希望有人能帮我弄清楚这件事。我有这段代码可以很好地与API版本10配合使用。然而,当我切换到API16时,第一个组件被加载,但第二个组件抛出一个异常——它在应用程序中不存在

除了API的更改外,没有任何更改。有人能解释一下吗? 我一直在寻找,还没有发现任何东西

谢谢

     /***************************************************
     * INITIATE THE BROADCAST RECEIVERS
     **************************************************/
    //create reference to the package manager and required receivers
    PackageManager pm  = getApplicationContext().getPackageManager();

    ComponentName BroadcastReceiver_Text = 
        new ComponentName(this, TextMessageReceiver.class.getName());
    ComponentName BroadcastReceiver_Phone = 
        new ComponentName(this, PhoneCallReceiver.class.getName());

    //turn ON the broadcast receivers for the texting
    try {
        pm.setComponentEnabledSetting(BroadcastReceiver_Text,
                PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
                PackageManager.DONT_KILL_APP);
        Log.i("Broadcast Receiver for Text", "Is Now ENABLED");
        //turn ON the broadcast receivers for the phone calls

        pm.setComponentEnabledSetting(BroadcastReceiver_Phone,
                PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
                PackageManager.DONT_KILL_APP);
        Log.i("Phone Receiver for Text", "Is Now ENABLED");

    }catch(Exception e){
        Log.i("NameNotFoundException", e.getMessage());
    }
        Log.i("AwayModeService", "OnCreate Ending");
}

请提供完整的堆栈跟踪。@Commonware-我找到了。我不知何故删除了清单文件中所需的代码。我想现在我需要离开一会儿。啊!非常感谢你愿意帮忙。(我不确定如何格式化此代码)'