Reputation: 55
My program is immediately crashing on my Android Emulator and I receive this in the Eclipse Console:
java.lang.NullPointerException
at com.android.ddmlib.Client.sendAndConsume(Client.java:572)
at com.android.ddmlib.HandleHello.sendHELO(HandleHello.java:142)
at com.android.ddmlib.HandleHello.sendHelloCommands(HandleHello.java:65)
at com.android.ddmlib.Client.getJdwpPacket(Client.java:671)
at com.android.ddmlib.MonitorThread.processClientActivity(MonitorThread.java:317)
at com.android.ddmlib.MonitorThread.run(MonitorThread.java:263)
How can I troubleshoot what is throwing this message? I'm new to Eclipse and Android.
The program completely crashes when I try to launch a dialog with a button, and refers back here:
@Override
protected Dialog onCreateDialog(int id) {
Dialog dialog;
switch (id) {
case TIME_DIALOG_ID:
return new TimePickerDialog(this,
mTimeSetListener, mHour24, mMinute, false);
case POWER_OFF_OPTIONS:
AlertDialog.Builder builder;
AlertDialog alertDialog;
Context mContext = getApplicationContext();
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.options,
(ViewGroup)findViewById(R.id.relativeLayout1));
//Capture view elements
mChkAudio = (CheckBox) findViewById(R.id.chkAudio);
mChkBluetooth = (CheckBox) findViewById(R.id.chkBlueTooth);
mChkNetwork = (CheckBox) findViewById(R.id.chkNetwork);
mChkWifi = (CheckBox) findViewById(R.id.chkWifi);
mBtnOK = (Button) findViewById(R.id.btnOK);
mBtnOK.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
DismissPowerOptions();
}
});
builder = new AlertDialog.Builder(mContext);
builder.setView(layout);
alertDialog = builder.create();
//return alertDialog;
default:
dialog = null;
}
return dialog;
}
Upvotes: 1
Views: 11414
Reputation: 1591
i solved this problem by click on INVALIDATE CACHE AND RESTART.
file -> Invalidate cache and restart ->invalidate and restart
Upvotes: 0
Reputation: 1746
The error is not coming from your program. It is a problem with an Eclipse plugin for Android: The "Dalvik Debug Monitor Server".
http://developer.android.com/guide/developing/debugging/ddms.html
Sometimes these things just get into a bad state and need to be restarted. Close the emulator and restart Eclipse. Start the emulator from the AVD Manager window using the button labelled "Start..". In the start dialog select the "WIPE ALL DATA" button to be sure you're getting a clean start.
If that doesn't solve it then try deleting your emulator in the AVD Manager and creating a new one.
Upvotes: 3