title: Method does not support request body:GET
body: <pre><code> class MySync extends AsyncTask{ ProgressDialog mProgressDialog;
  
      protected void onPreExecute(){
         mProgressDialog = ProgressDialog.show(MainActivity.this, "Loading...", "Data is Loading...");
      }
      @Override
      protected Integer doInBackground(String... params)  {
          int result = 0;
         //String url="http://192.168.0.108:8080/sbi/login?"+"key1="+params[0]+"&amp;key2="+params[1]";
          int code;
          try {
              URL hp=new URL("http://192.168.0.108:8080/sbi/login?"+"key1="+params[0]+"&amp;key2="+params[1]);
              HttpURLConnection urlConnection=(HttpURLConnection)hp.openConnection();
              urlConnection.connect();
              Log.i("A", "connect");
              code=urlConnection.getResponseCode();
              Log.i("A","code");
              boolean a=check(code);
  
             if(a){
                  //urlConnection.setDoInput(true);
                  Log.i("A", "input");
                 // urlConnection.setDoOutput(true);
                  Log.i("A", "output");
                  urlConnection.setRequestMethod("GET");
                  Log.i("A", "get");
                  byte [] buf=("key1=" + params[0] + "&amp;key2=" + params[1]).getBytes();
                  urlConnection.getOutputStream().write(buf);
                  Log.i("A", "sent");
              }
              else{
                  Log.i("A","error");
                  result=3;
              }
          }
          catch (MalformedURLException e) {
              Log.i("e", "Error");
          }
          catch (IOException e){
              e.printStackTrace();
          }
      protected boolean check(int c){
              if(c==200) return true;
              else return false;
          }
     }
  </code></pre>
  
  <p>This code gives error method does not support a request body:get? also if i insert setdooutput(true) then it gives error already connected. I am newbie to android and i am making my college project</p>