title: Android Retrofit2 returning not found(404 error)
body: <p>I'm creating an android application with Retrofit2. It was worked successfully, but today I changed the response object(LoginResponse.java). Now it's returning "<strong>not found (404)</strong>" error. I think the error will occur from here <strong>response.isSuccessful()</strong>. I have tried several hours to solve this problem, but couldn't find a way. please help me to solve this. Thanks in advance.</p>
  
  <p>here is my code:</p>
  
  <p><strong>Form backend (Postman response like this)</strong></p>
  
  <pre><code>{
      "data": [
          {
              "token": "sample"
          }
      ],
      "msg": "Authentication successfull.",
      "status": "success"
  }
  </code></pre>
  
  <p><strong>NetworkClient.java</strong></p>
  
  <pre><code>public static Retrofit getRetrofit() {
  
          if (retrofit == null) {
              OkHttpClient.Builder builder = new OkHttpClient.Builder();
              OkHttpClient okHttpClient = builder.build();
  
              retrofit = new Retrofit.Builder()
                      .baseUrl("http://api.acloud.net/")
                      .addConverterFactory(GsonConverterFactory.create())
                      .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
                      .client(okHttpClient)
                      .build();
  
          }
  
          return retrofit;
      }
  </code></pre>
  
  <p><strong>LoginResponse.java</strong></p>
  
  <pre><code>@SerializedName("data")
      @Expose
      private List&lt;TockenResponse&gt; data = null;
      @SerializedName("msg")
      @Expose
      private String msg;
      @SerializedName("status")
      @Expose
      private String status;
  
      public List&lt;TockenResponse&gt; getData() {
          return data;
      }
  
      public void setData(List&lt;TockenResponse&gt; data) {
          this.data = data;
      }
  
      public String getMsg() {
          return msg;
      }
  
      public void setMsg(String msg) {
          this.msg = msg;
      }
  
      public String getStatus() {
          return status;
      }
  
      public void setStatus(String status) {
          this.status = status;
      }
  </code></pre>
  
  <p><strong>NetworkInterface.java</strong></p>
  
  <pre><code>@FormUrlEncoded
      @POST("auth/login")
      Call&lt;LoginResponse&gt; doLogin(@Field("username") String username, @Field("password") String password);
  </code></pre>
  
  <p><strong>Login.java</strong></p>
  
  <pre><code> private void doLogin(String username, String password) {
  
                  NetworkInterface service = NetworkClient.getRetrofit().create(NetworkInterface.class);
                  Call&lt;LoginResponse&gt; call = service.doLogin(username, password);
                  call.enqueue(new Callback&lt;LoginResponse&gt;() {
                      @Override
                      public void onResponse(Call&lt;LoginResponse&gt; call, Response&lt;LoginResponse&gt; response) {
                          if (response.isSuccessful()) {
                              progressDoalog.dismiss();
                              LoginResponse loginResponse = response.body();
                              if(loginResponse.getStatus().equals("success")) {
  
  //                                dataManager.setTocken(response.body().getToken());
                                  Log.d("token2345", "qwertgf");
                                  Intent intent = new Intent(LoginActivity.this, MainActivity.class);
                                  startActivity(intent);
                                  finish();
  
                              }else{
  
                                  Toast.makeText(getApplicationContext(), "Username or Password Incorrect !", Toast.LENGTH_LONG).show();
  
                              }
                          }else {
  
                              Toast.makeText(getApplicationContext(), response.message() +" "+ response.code(), Toast.LENGTH_LONG).show();
  
                          }
                      }
  
                      @Override
                      public void onFailure(Call&lt;LoginResponse&gt; call, Throwable t) {
  
                          Toast.makeText(getApplicationContext(), "Something went wrong...!", Toast.LENGTH_LONG).show();
  
                      }
                  });
  
              }
          });
  </code></pre>
  
  <p>Here is my Logcat</p>
  
  <pre><code>11-02 12:16:04.531 11501-11501/com.application.mobile.application D/PhoneWindow: *FMB* isFloatingMenuEnabled mFloatingMenuBtn : null
      *FMB* isFloatingMenuEnabled return false
  11-02 12:16:04.536 11501-12274/com.application.mobile.application D/OkHttp: --&gt; POST http://a.acloud.net/auth/login
      Content-Type: application/x-www-form-urlencoded
  11-02 12:16:04.541 11501-12274/com.application.mobile.application D/OkHttp: Content-Length: 38
      username=gihand&amp;password=your_password
      --&gt; END POST (38-byte body)
  11-02 12:16:04.576 11501-11582/com.application.mobile.application D/mali_winsys: new_window_surface returns 0x3000,  [597x270]-format:1
  11-02 12:16:06.081 11501-12274/com.application.mobile.application D/OkHttp: &lt;-- 404 Not Found http://a.acloud.net/auth/login (1537ms)
      Date: Fri, 02 Nov 2018 06:46:06 GMT
      Server: Apache/2.4.18 (Ubuntu)
      0: Content-Type : Application/json
      Cache-Control: no-cache, private
      Content-Length: 411
      Content-Type: application/json
      X-Cache: MISS from squid_Wifi
      X-Cache-Lookup: MISS from squid_Wifi:3128
      Via: 1.1 squid_Wifi (squid/3.5.27)
      Connection: keep-alive
      {"data":[{"token":"ssdsdsdsdsdsdsdsdfdcsdfdd"}],"msg":"Authentication successfull.","status":"success"}
      &lt;-- END HTTP (411-byte body)
  11-02 12:16:06.136 11501-11501/com.application.mobile.application D/ViewRootImpl: Buffer Count from app info with  ::-1 &amp;&amp; -1 for :: com.application.mobile.application from View :: -1 DBQ Enabled ::false false
  11-02 12:16:06.176 11501-11582/com.application.mobile.application D/mali_winsys: new_window_surface returns 0x3000,  [222x78]-format:1
  11-02 12:21:10.401 11501-11501/com.application.mobile.application V/ActivityThread: updateVisibility : ActivityRecord{1b786a90 token=android.os.BinderProxy@29c3be6c {com.application.mobile.application/com.application.mobile.application.ui.login.LoginActivity}} show : true
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/muJqQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/muJqQ.png" alt="enter image description here"></a></p>