I am just trying to run a simple test on my "hello world" programme in android studio , the programme is below:
package com.example.gautam.droidone.tests;
import android.test.ActivityInstrumentationTestCase2;
import android.widget.TextView;
import com.example.gautam.droidone.MainActivity;
import com.example.gautam.droidone.R;
import android.util.Log;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActivity> {
MainActivity activity;
public MainActivityTest() {
super(MainActivity.class);
}
@Override
protected void setUp() throws Exception {
super.setUp();
activity = getActivity();
}
public void testMainActivity() {
TextView textView = (TextView) activity.findViewById(R.id.hello_world);
Log.d("MainActivityTest", textView.getText().toString());
assertNotNull(textView);
}
}
When i click on the debug button, i get the following error in the console:
Error running MainActivityTest: Unable to open debugger port (127.0.0.1:58061): java.net.SocketException "socket closed".
Similar so threads:
I googled the error and found a few solutions to the problem, most of them did't work, then i saw THIS article and in the comments section a few people have suggested that you need to turn off build-process. how do you do that , on reading more on google , i found that since android 1+ this option is no longer available , so how do i turn off build process ? and once again why am i getting this error:
Error running MainActivityTest: Unable to open debugger port (127.0.0.1:58061): java.net.SocketException "socket closed"