0

Android app is crashing with An error occurred while executing doInBackground() in android 9

in version < 9 my app is running good but in android 9 this error is appear so if anyone have the solution please tell me my app is on play store crashes increases day by day so please help me what should i do to solve this ... error

  @Override
    protected String doInBackground(Void... params) {
        String url = "";
        switch (name){        
             case "Islamic channel":
                url = Constant.Islamic_URL;
                break;
            case "Faizan-e-Madina":
                url = Constant.Faizan_e_Madina_URL;
                break;

            default:
                    Log.d("end","case");
        }
            HttpClient httpClient = new DefaultHttpClient(); // here is error show
            HttpGet httpGet = new HttpGet(url);
            try {
                HttpResponse response = httpClient.execute(httpGet);
                HttpEntity httpEntity = response.getEntity();
                return EntityUtils.toString(httpEntity);

            } catch (IOException e) {
                Log.d("DownloadData" , e.getMessage());
                e.printStackTrace();
            }
        return null;
    }
Zahid Hussain
  • 107
  • 1
  • 1
  • 9

0 Answers0