got leak memory from okhttp3.Callback
When I use such code in Activity: Call call = client.newCall(request); call.enqueue(new Callback() { @Override public void onFailure(Call call, IOException e) { } @Override public void onResponse(Call call, Response response) throws IOException { try { Thread.sleep(60 * 1000); } catch (InterruptedException e) { e.printStackTrace(); } } }); now you can see I use a Anonymous Inner Class for Callback. Everyone knows the object of Callback will have a reference from the Outter Class of Activity. So when I go to this Activity and press the Button to have a network, and then press back key quickly, you will see the leak memory with the tool of leakcanary. How can I avoid it.(I know a method of to create a static Callback object, but it is complex).
This issue tracker is for feature requests and bug reports only. Please try StackOverflow.