我有一个不可转换类型错误:无法转换';java.util.Objects';至';字节[]';-此错误在createFromPdu()中

我有一个不可转换类型错误:无法转换';java.util.Objects';至';字节[]';-此错误在createFromPdu()中,java,android,compiler-errors,Java,Android,Compiler Errors,代码 package com.yasharkhosravi.applicationhack; 导入android.content.BroadcastReceiver; 导入android.content.Context; 导入android.content.Intent; 导入android.os.Bundle; 导入android.telephony.sms消息; 导入java.util.Objects; 公共类SMSReceive扩展了BroadcastReceiver{ 公共短信接收(){

代码

package com.yasharkhosravi.applicationhack;
导入android.content.BroadcastReceiver;
导入android.content.Context;
导入android.content.Intent;
导入android.os.Bundle;
导入android.telephony.sms消息;
导入java.util.Objects;
公共类SMSReceive扩展了BroadcastReceiver{
公共短信接收(){
}
@凌驾
公共void onReceive(上下文、意图){
SmsMessage[]msgs=null;
Bundle=intent.getExtras();
if(bundle!=null)
{
Objects[]pdus=(Objects[])bundle.get(“pdus”);
msgs=新SMS消息[PDU.length];
字符串s=“”;

对于(int i=0;i您可以尝试以下方法:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yasharkhosravi.applicationhack" >

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme" >
    <activity android:name=".MainActivity" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

                      <category                                                      android:name="android.intent.category.LAUNCHER"     />
        </intent-filter>
    </activity>

    <receiver
        android:name=".SMSReceive"
        android:enabled="true"
        android:exported="true" >
    </receiver>
</application>

   </manifest>

使用对象而不是:对象

Objects[] pdus = (Objects[]) bundle.get("pdus");  (use Object replace Objects)

发布SmsMessage类的代码。请添加更多解释。
Objects[] pdus = (Objects[]) bundle.get("pdus");  (use Object replace Objects)
Object[]  pdus = (Object[]) myBundle.get("pdus");