title: Android Asynctask addheader
body: <p>I am trying to connect with my webservice restful to login a user.</p>
  
  <p>i do that:</p>
  
  <pre><code>  private class LoginTask extends AsyncTask {
         OkHttpClient client = new OkHttpClient();
          String base64NamePass;
  
          public LoginTask(String base64NamePass){
              this.base64NamePass = base64NamePass;
          }
          @Override
          protected Object doInBackground(Object[] params) {
              Response response = null;
              try {
                 response =  get("http://192.168.0.27:8080/ServicioRestTFG/rest/UsuariosServicesRs/login", base64NamePass);
              } catch (IOException e) {
                  e.printStackTrace();
              }
              return response;
          }
  
          private Response get (String url, String base64NamePass) throws IOException {
              Request request = new Request.Builder()
                      .get()
                      .url(url)
                      .addHeader("Authorization", base64NamePass)
                      .build();
              return client.newCall(request).execute();
          }
      }
  </code></pre>
  
  <p>First i encoded the user and the pass with base64 and then i send it to my server.</p>
  
  <p>But when i add the header:</p>
  
  <pre><code>Request request = new Request.Builder()
                          .get()
                          .url(url)
                          .addHeader("Authorization", base64NamePass)
                          .build();
                  return client.newCall(request).execute();
  </code></pre>
  
  <p>the app forceclosed and it doesnt show me what is the error, only close.</p>
  
  <p>Any idea?</p>
  
  <p>thanks</p>