Stack error list:

07-27 07:55:50.863 4854-4854/com.project.samuliak.psychogram E/AndroidRuntime: FATAL EXCEPTION: main Process: com.project.samuliak.psychogram, PID: 4854 java.lang.NoSuchMethodError: No interface method getAllTabsByDoctor(Ljava/lang/String;)Lretrofit2/Call; in class Lcom/project/samuliak/psychogram/API/PsychogolistAPI; or its super classes (declaration of 'com.project.samuliak.psychogram.API.PsychogolistAPI' appears in /data/data/com.project.samuliak.psychogram/files/instant-run/dex/slice-slice_2-classes.dex) at com.project.samuliak.psychogram.Activity.main.menu.common_items.CommunicationActivity.initTab(CommunicationActivity.java:66) at com.project.samuliak.psychogram.Activity.main.menu.common_items.CommunicationActivity.onCreate(CommunicationActivity.java:55) at android.app.Activity.performCreate(Activity.java:5990) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) at android.app.ActivityThread.access$800(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 

Call code:

 public class CommunicationActivity extends AppCompatActivity { private SectionsPagerAdapter mSectionsPagerAdapter; private ViewPager mViewPager; private PsychogolistAPI service; private ProgressDialog progressDialog; private Psychogolist doctor; private Client client; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_communication); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); initTab(); } private void initTab() { Retrofit retrofit = new Retrofit.Builder() .baseUrl(Constants.HOST) .addConverterFactory(GsonConverterFactory.create()) .build(); service = retrofit.create(PsychogolistAPI.class); mViewPager = (ViewPager) findViewById(R.id.container); final TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs); Call<List<Tab>> listCall = service.getAllTabsByDoctor("www"); progressDialog = new ProgressDialog(this); //Utils.initProgressDialog(progressDialog, this); assert listCall != null; listCall.enqueue(new Callback<List<Tab>>() { @Override public void onResponse(Call<List<Tab>> call, Response<List<Tab>> response) { if (response.isSuccessful()){ // mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager(), // response.body()); // mViewPager.setAdapter(mSectionsPagerAdapter); // assert tabLayout != null; // tabLayout.setupWithViewPager(mViewPager); } //progressDialog.dismiss(); } @Override public void onFailure(Call<List<Tab>> call, Throwable t) { Toast.makeText(getBaseContext(), R.string.connecting_error, Toast.LENGTH_LONG).show(); //progressDialog.dismiss(); } }); } 

API:

  // список табов по доктору @GET("tab/doctor{name}") Call<List<Tab>> getAllTabsByDoctor(@Path("name") String psLogin); 

What's the problem? How to fix?

  • try making a public method - Kirill Stoianov
  • If you are talking about the method where the call code is executed - that did not help - Samuliak
  • show more code, show the class where this method is - Kirill Stoianov
  • added, but still xs poemu not working - Samuliak
  • one
    Everything, the error is corrected. I do not know why, but it disappeared after changing the GET method to POST. Although the server was also GET, I had to post there too. - Samuliak

0