I am trying to execute connected test for P4, however I am reciing an "Null pointer exception error" for P4
Error message:
:00:02 PM null
java.lang.NullPointerException
at com.android.ddmlib.Client.read(Client.java:692)
at com.android.ddmlib.MonitorThread.processClientActivity(MonitorThread.java:304)
at com.android.ddmlib.MonitorThread.run(MonitorThread.java:256)
It is a standard test, verifying non-empty string in the Async task
Test function:
public void runCloudModuleTest() {
    String joke = null;
    JokesAsyncTask jokesAsyncTask = new JokesAsyncTask(getContext(), null);
    jokesAsyncTask.execute();
    try {
        joke = jokesAsyncTask.get();
        Log.d("CloudModuleTest", "Retrieved a non-empty string successfully: " + joke);
    } catch (Exception e) {
        e.printStackTrace();
    }
    assertNotNull(joke);
}
Can someone help me understand what the issue is?
AsyncTask: The Async task pulls data from google cloud engine
public class JokesAsyncTask extends AsyncTask, Void, String> {
private static JokeApi myApiService = null;
private Context mContext;
private String mResult;
private ProgressBar mProgressBar;
public JokesAsyncTask(Context context, ProgressBar progressBar) {
    this.mContext = context;
    this.mProgressBar = progressBar;
}
@Override
protected void onPreExecute() {
    super.onPreExecute();
    if (mProgressBar != null) {
        mProgressBar.setVisibility(View.VISIBLE);
    }
}
@Override
protected String doInBackground(Pair<Context, String>... pairs) {
    if (myApiService == null) {
        JokeApi.Builder builder = new JokeApi.Builder(AndroidHttp.newCompatibleTransport(),
                new AndroidJsonFactory(), null)
                .setRootUrl("https://testandroiddevelopment.appspot.com/_ah/api/");
        myApiService = builder.build();
    }
    try {
        return myApiService.sendJoke(new JokeBean()).execute().getJoke();
    } catch (IOException e) {
        return e.getMessage();
    }
}
@Override
protected void onPostExecute(String result) {
    super.onPostExecute(result);
    if (mProgressBar != null) {
        mProgressBar.setVisibility(View.GONE);
    }
    mResult = result;
    startJokeDisplayActivity();
}
private void startJokeDisplayActivity() {
    Intent intent = new Intent(mContext, JokeViewActivity.class);
    intent.putExtra(JokeViewActivity.JOKE_KEY, mResult);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    mContext.startActivity(intent);
}
}
I have referenced the variable and it is not an issue due due to the below post, however I did investigate and finally cleaned up and rebuild the project that helped resolved the issue
