title: Retrofit 2.0 - unable to invoke no-args constructor for interface
body: <p>I am creating an android app that would upload data to a database using Retrofit2. When I submit the data it goes to the database, but an error always says this <strong>unable to invoke no-args constructor for interface</strong>. I tried searching for different solutions but don't seem to work.</p>
  
  <p>This is my API Class:</p>
  
  <pre><code>import javax.xml.transform.Result;
  import retrofit2.http.Field;
  import retrofit2.http.FormUrlEncoded;
  import retrofit2.http.POST;
  
  public interface RegisterAPI {
  
  @FormUrlEncoded
  @POST("insertText.php")
  retrofit2.Call&lt;Result&gt; createUser(
          @Field("name") String name,
          @Field("age") String age);
  
  }
  </code></pre>
  
  <p>And this is my InsertActivity Class:</p>
  
  <pre><code>public static final String ROOT_URL= "https://MYURL/";
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_insert);
  
      editTextName = (EditText) findViewById(R.id.editTextName);
      editTextAge = (EditText) findViewById(R.id.editTextAge);
  
      buttonRegister = (Button) findViewById(R.id.buttonRegister);
  
      buttonRegister.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              insertUser();
          }
      });
  }
  
    public void insertUser(){
  
      String name = editTextName.getText().toString().trim();
      String age = editTextAge.getText().toString().trim();
  
      Gson gson = new GsonBuilder()
              .setLenient()
              .create();
  
      Retrofit retrofit = new Retrofit.Builder()
              .baseUrl(ROOT_URL)
              .addConverterFactory(GsonConverterFactory.create(gson))
              .build();
  
      RegisterAPI service = retrofit.create(RegisterAPI.class);
  
      Call&lt;Result&gt; call = service.createUser(
             name,
             age
      );
  
      call.enqueue(new Callback&lt;Result&gt;() {
          @Override
          public void onResponse(Call&lt;Result&gt; call, Response&lt;Result&gt; response) {
              Toast.makeText(getApplicationContext(), "SUCCESS", Toast.LENGTH_LONG).show();
          }
  
          @Override
          public void onFailure(Call&lt;Result&gt; call, Throwable t) {
              Toast.makeText(getApplicationContext(), t.getMessage(), Toast.LENGTH_LONG).show();
          }
      });
  
  }
  </code></pre>