源代码与android studio的字节码不匹配

时间:2017-10-29 19:05:45

标签: java android debugging firebase crash

以下是我的代码段。当我第一次创建listadapter时,这段代码工作了一次。但有一段时间它不起作用。该应用在点击以下代码段中的list.add时会一直崩溃。

public class ViewRequestActivity extends AppCompatActivity {

private ArrayList<HashMap<String, String>> list;

DatabaseReference databaseRequests;
private TextView textViewRequestNo;
private EditText editTextRequestPurpose;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_view_request);        databaseRequests = FirebaseDatabase.getInstance().getReference("Requests");
    Query query = databaseRequests.orderByChild("requestNo").equalTo(11);
    query.addValueEventListener(new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
            for (DataSnapshot messageSnapshot: dataSnapshot.getChildren()) {
                String requestDate = (String) messageSnapshot.child("requestDate").getValue();
                String requestPurpose = (String) messageSnapshot.child("requestPurpose").getValue();
                String requestConPerson = (String) messageSnapshot.child("requestConPerson").getValue();
                String requestSepList = (String) messageSnapshot.child("requestSepList").getValue();
                //populateRequests(requestDate,requestPurpose,requestConPerson,requestSepList);

                HashMap<String,String> temp=new HashMap<String, String>();
                temp.put(FIRST_COLUMN,requestDate);
                temp.put(SECOND_COLUMN,requestPurpose);
                temp.put(THIRD_COLUMN,requestConPerson);
                temp.put(FOURTH_COLUMN,requestSepList);
                list.add(temp);
                ListViewAdapter adapter= new ListViewAdapter(ViewRequestActivity.this,list);
                listView.setAdapter(adapter);
            }
        }

最初我试过 // populateRequests(requestDate,requestPurpose,requestConPerson,requestSepList); 函数调用和列表视图将正确填充所有值

我不知道发生了什么事后,在使用adb到移动设备调试应用程序时,它总是在looper.java内部崩溃,当它到达这一行“ list.add(temp); ”时说“源代码与字节代码不匹配”。

为此我还禁用了即时运行

looper.java如下

 final long newIdent = Binder.clearCallingIdentity();
        if (ident != newIdent) {
            Log.wtf(TAG, "Thread identity changed from 0x"
                    + Long.toHexString(ident) + " to 0x"
                    + Long.toHexString(newIdent) + " while dispatching to "
                    + msg.target.getClass().getName() + " "
                    + msg.callback + " what=" + msg.what);
        }

        msg.recycleUnchecked();
    }
}

我尝试了很多调试,但不确定它总是会崩溃。 我希望有人能说明我所缺少的东西。

0 个答案:

没有答案