Sitelet https://github.com/android-async-http/android-async-http/issues/1391
Skip to content

[Issue] Use looper thread, must call Looper.prepare error v1.4.11 #1391

Description

@dss-kenya

I tried upgrading from v1.4.9 to v1.4.11 and i have a class that extends JsonHttpResponseHandler, however, the code now crashes with the following error:

java.lang.AssertionError: use looper thread, must call Looper.prepare() first!
    at com.loopj.android.http.Utils.asserts(Utils.java:39)
    at com.loopj.android.http.AsyncHttpResponseHandler.<init>(AsyncHttpResponseHandler.java:137)
    at com.loopj.android.http.AsyncHttpResponseHandler.<init>(AsyncHttpResponseHandler.java:122)
    at com.loopj.android.http.AsyncHttpResponseHandler.<init>(AsyncHttpResponseHandler.java:110)
    at com.loopj.android.http.TextHttpResponseHandler.<init>(TextHttpResponseHandler.java:73)
    at com.loopj.android.http.JsonHttpResponseHandler.<init>(JsonHttpResponseHandler.java:48)

I also see that in the code we have the following in the sdk:

public AsyncHttpResponseHandler(boolean usePoolThread) {
        this(usePoolThread ? null : Looper.myLooper(), usePoolThread);
    }

Is therefore something that is missed? and Looper.prepare has to be called in the sdk? Or how do we handle this?
also, this crash does not seem to happen on version 1.4.9.

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions