Java – Android must implement inherited abstract methods

Android must implement inherited abstract methods… here is a solution to the problem.

Android must implement inherited abstract methods

I’ve downloaded a project with this feature and it works fine, but when I copy this feature into my project, I get an error:

The type new AsyncHttpResponseHandler(){} must implement the inherited abstract method AsyncHttpResponseHandler.onSuccess(int, Header[], byte[])

The method onSuccess(String) of type new AsyncHttpResponseHandler(){} must override or implement a supertype method

The method onFailure(int, Throwable, String) of type new AsyncHttpResponseHandler(){} must override or implement a supertype method

I tried All hints in this question, but nothing helps. Any possible solutions?

public void syncSQLiteMySQLDB(){
    Create AsycHttpClient object
    AsyncHttpClient client = new AsyncHttpClient();
    RequestParams params = new RequestParams();
    ArrayList<HashMap<String, String>> userList =  controller.getAllUsers();
        if(controller.dbSyncCount() != 0){
            params.put("usersJSON", controller.composeJSONfromSQLite());
  "",params ,new AsyncHttpResponseHandler() {
                public void onSuccess(String response) {
                    try {
                        JSONArray arr = new JSONArray(response);
                        for(int i=0; i<arr.length(); i++){
                            JSONObject obj = (JSONObject)arr.get(i);
                        Toast.makeText(getApplicationContext(), "DB Sync completed!", Toast.LENGTH_LONG).show();
                    } catch (JSONException e) {
                        Toast.makeText(getApplicationContext(), "Error Occured [Server's JSON response might be invalid]!", Toast.LENGTH_LONG).show();

                public void onFailure(int statusCode, Throwable error, String content) {
                    if(statusCode == 404){
                        Toast.makeText(getApplicationContext(), "Requested resource not found", Toast.LENGTH_LONG).show();
                    }else if(statusCode == 500){
                        Toast.makeText(getApplicationContext(), "Something went wrong at server end", Toast.LENGTH_LONG).show();
                        Toast.makeText(getApplicationContext(), "Unexpected Error occcured! [Most common Error: Device might not be connected to Internet]", Toast.LENGTH_LONG).show();
            Toast.makeText(getApplicationContext(), "SQLite and Remote MySQL DBs are in Sync!", Toast.LENGTH_LONG).show();
            Toast.makeText(getApplicationContext(), "No data in SQLite DB, please do enter User name to perform Sync action", Toast.LENGTH_LONG).show();


Depending on your error and < a href="" rel="noreferrer noopener nofollow" > API , you cannot create a new signature for an overridden methodYour method must have the same signature as the parent (super class)/interface:

Check JLS (§8.4.2)

It follows that is a compile-time error if […] a method with a signature that is override-equivalent […] has a different return type or incompatible throws clause.

In your case, this signature must be:

public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
      Successfully got a response

public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error)
      Response failed :(


public void onSuccess(String response) {
public void onFailure(int statusCode, Throwable error, String content) {

Recovering…. Like above and Declare your methods as described in the AsyncHttpResponseHandler API and add them to suit your needs.

Related Problems and Solutions