Pandasai Pandasai - 6 months ago 17
Java Question

Android App crashes on startup with nothing changed..?

I have an Android App project in Android Studio that I had working perfectly fine a few days ago. I came into work today, literally changing nothing and when I launch it now, it just crashes on startup. I really don't understand what the stacktrace is trying to tell me..

[ 08-21 16:59:35.445 8492:
8492 D/ ]
HostConnection::get() New Host
Connection established 0xa279c3c0, tid 8492

[ 08-21 16:59:35.499 8492:
8520 D/ ]
HostConnection::get() New Host
Connection established 0xa279c740, tid 8520
08-21 16:59:35.559 8492-8492/com.example.pmatthews.appointmentcreator
E/AndroidRuntime: FATAL EXCEPTION: main

Process: com.example.pmatthews.appointmentcreator, PID: 8492

java.lang.NullPointerException: Attempt to invoke virtual method
'java.lang.String[] java.lang.String.split(java.lang.String)' on a null
object reference





at android.os.AsyncTask.finish(

at android.os.AsyncTask.-wrap1(

at android.os.AsyncTask$InternalHandler.handleMessage(

at android.os.Handler.dispatchMessage(

at android.os.Looper.loop(


at java.lang.reflect.Method.invoke(Native Method)


08-21 16:59:36.728 2155-2243/
E/AudioRecord: Could not get audio input for session 897, record source
1999, sample rate 16000, format 0x1, channel mask 0x10, flags 0
08-21 16:59:36.731 2155-2243/
E/AudioRecord-JNI: Error creating AudioRecord instance: initialization check
failed with status -22.
08-21 16:59:36.731 2155-2243/
E/ Error code -20 when initializing native
AudioRecord object.
08-21 16:59:36.731 2155-2243/
E/ActivityThread: Failed to find provider info for

startup activity-

class GetConNum extends AsyncTask<String, Void, String> {
StringBuilder sb = new StringBuilder();

String status = null;
Activity context;
ListView listView = (ListView) findViewById(;
TextView txtV = (TextView) findViewById(;
TextView txtV1 = (TextView) findViewById(;
TextView txtV2 = (TextView) findViewById(;
TextView txtV3 = (TextView) findViewById(;
TextView txtV4 = (TextView) findViewById(;
TextView txtV5 = (TextView) findViewById(;
TextView txtV6 = (TextView) findViewById(;
TextView txtV7 = (TextView) findViewById(;
TextView txtV8 = (TextView) findViewById(;
TextView txtV9 = (TextView) findViewById(;
TextView txtV10 = (TextView) findViewById(;
TextView txtV11 = (TextView) findViewById(;
TextView txtV12 = (TextView) findViewById(;
TextView txtV13 = (TextView) findViewById(;
TextView txtV14 = (TextView) findViewById(;
TextView txtV15 = (TextView) findViewById(;
TextView txtV16 = (TextView) findViewById(;
TextView txtV17 = (TextView) findViewById(;
TextView txtV18 = (TextView) findViewById(;
TextView txtV19 = (TextView) findViewById(;

public GetConNum(Activity context, ListView listView){
this.context = context;
this.listView = listView;

public void onPreExecute(){

public String doInBackground(String... connUrl){
HttpURLConnection conn = null;
BufferedReader reader;

final URL url = new URL(connUrl[0]);
conn = (HttpURLConnection) url.openConnection();
conn.addRequestProperty("Content-Type", "application/json;
int result = conn.getResponseCode();
if(result == 200){

InputStream in = new
reader = new BufferedReader(new InputStreamReader(in));

String line = null;

while ((line = reader.readLine()) != null){
status = line;
res = res + result;



}catch(Exception ex){

return status;

protected void onPostExecute(String result){

String[] resultArray = result.split(",");

if (resultArray.length == 0){

}else if (resultArray.length == 1) {
[[{}]]","").replaceAll("\\[", "").replaceAll("\\]",
"").replaceAll("\"","").replaceAll(":", " :
: 00 AM", ""));
}else if (resultArray.length == 2){

Answer Source

Check your AsyncTask.
You are trying to split a null String.

java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String[] java.lang.String.split(java.lang.String)' on a null object reference

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download