Current thread has not called Looper.prepare(). Forcing synchronous mode
01-19 22:52:30.683: W/AsyncHttpRH(23815): Current thread has not called Looper.prepare(). Forcing synchronous mode.

01-19 22:52:30.685: W/System.err(23815): java.lang.IllegalArgumentException: Synchronous ResponseHandler used in AsyncHttpClient. You should create your response handler in a looper thread or use SyncHttpClient instead.
01-19 22:52:30.686: W/System.err(23815):    at com.loopj.android.http.AsyncHttpClient.sendRequest(AsyncHttpClient.java:1493)
01-19 22:52:30.686: W/System.err(23815):    at com.loopj.android.http.AsyncHttpClient.get(AsyncHttpClient.java:1078)
01-19 22:52:30.686: W/System.err(23815):    at com.loopj.android.http.AsyncHttpClient.get(AsyncHttpClient.java:1052)
01-19 22:52:30.686: W/System.err(23815):    at agriya.talkr.localdb.RestClient.get(RestClient.java:29)
01-19 22:52:30.686: W/System.err(23815):    at agriya.talkr.localdb.ServerCallee.execute(ServerCallee.java:77)
01-19 22:52:30.686: W/System.err(23815):    at agriya.talkr.CreateGroup$synchronizeInBg.doInBackground(CreateGroup.java:213)
01-19 22:52:30.686: W/System.err(23815):    at agriya.talkr.CreateGroup$synchronizeInBg.doInBackground(CreateGroup.java:1)
01-19 22:52:30.686: W/System.err(23815):    at android.os.AsyncTask$2.call(AsyncTask.java:292)
01-19 22:52:30.686: W/System.err(23815):    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
01-19 22:52:30.686: W/System.err(23815):    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
01-19 22:52:30.686: W/System.err(23815):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
01-19 22:52:30.686: W/System.err(23815):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
01-19 22:52:30.686: W/System.err(23815):    at java.lang.Thread.run(Thread.java:818)

下面我已经发布了代码并指出了错误行:
creategroup.java:创建组:
public class CreateGroup extends AppCompatActivity {

........
........

    @Override
        protected String doInBackground(String... params) {
          try {

       .......
      ServerCallee.execute(Constants.SERVER_CALL_newGroup, map); --->213th line
    } catch (JSONException e) {

        e.printStackTrace();
        return "1";

        }

服务器callee.java:
public static void execute(final Constants _service, HashMap<String, String> params){

  ........
  ........


 RestClient.get(null, rqm, new JsonHttpResponseHandler(){  --->77th line

 ........
    @Override
    public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) {
        System.out.println("onFailure - String: " + _service.toString());

        Log.e("fail 1", "Test");


     }
      .......(On Success response handler)

restclient.java:
 public class RestClient {

          private static AsyncHttpClient client = new AsyncHttpClient();

      public static void get( String url,  RequestParams params, final JsonHttpResponseHandler responseHandler) {

              client.get(getAbsoluteUrl(url), params, responseHandler); -->29th line

          }

          public static void post(final String url, final RequestParams params, final JsonHttpResponseHandler responseHandler) {

             client.get(getAbsoluteUrl(url), params, responseHandler);

          }
    }

最佳答案:

AsyncTaskSyncHttpClient