Different behaviour debug vs release mode android -- release mode freezes
<p>I am trying to make current 4.0 app compatible with 2.1 android devices. 
I used to get an exception when I call HttpResponse but I do not know why. 
All I know is that for API 8, there are 2 lines I need to comment out in order to avoid error and couple more tweaks and I am good to go. I am not entirely sure what these lines do or if they are the cause of the problem (since I just modified the code snippet from some tutorial) but the code is working now....These are the lines I commented out:</p>

<pre><code> /*StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
   StrictMode.setThreadPolicy(policy);
   */
</code></pre>

<p>but in debug mode. Once I try out the release mode I get to the same place the app froze before... I placed some Toast messages as debugging messages to check the release mode but they are not displaying (maybe because I have a progressDialog going on).</p>

<p>The main problem is that in debug mode it's working fine now (tested in 2 different devices), but the release mode keeps having the problem (and I can't even debug it).</p>

<p>Here is the code where I think my app is failing. In debug mode it used to fail when calling HttpResponse. Any ideas?</p>

<pre><code>public String Send(String jsonString, String url, Context ctxt)
{
    try{

        System.out.println(jsonString);

        HttpPost request = new HttpPost(url);
        request.setHeader("Accept", "text/xml");
        request.setHeader("Host", "www.my-host.com" );
        request.setHeader("Content-type", "application/json");
        StringEntity stringEnt = new StringEntity(jsonString); 
        stringEnt.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
        request.setEntity(stringEnt);

        //instantiates httpclient to make request
        DefaultHttpClient httpclient = new DefaultHttpClient();

        HttpResponse response = httpclient.execute(request);
        HttpEntity responseEntity = response.getEntity();       

        //Obtenemos el xml de la respuesta
        String responseXML = EntityUtils.toString(responseEntity);
        return responseXML;
    }
    catch(Exception e)
    {
        Toast.makeText(ctxt, "Error registering user", Toast.LENGTH_SHORT).show();
        Log.i("login", "" + e.getMessage());
        return "error";
    }


}
</code></pre>

<p>}</p>

<p>thanks</p>
