I have already asked a lot of questions about creating an application with the login function, one of the steps to create such an application is to create an interface for correct operation, first I used this interface:
@POST("/{login}/{password}") Call<LoginRequest> savePost(@Field("id") Integer id, @Field("password") String password); then I found out that on the server they are waiting for me to have clean json, and so I send the form to the server, and I started using this code for the interface:
@POST("/{login}/{password}") Call<LoginRequest> savePost(@Body LoginRequest body); and after replacing the first option with me, the second studio swears at the savepost method:
--------- beginning of crash 07-11 03:38:27.598 25289-25289/com.example.developer_4.test_log E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.developer_4.test_log, PID: 25289 java.lang.IllegalArgumentException: No Retrofit annotation found. (parameter #1) for method APIService.savePost at retrofit2.ServiceMethod$Builder.methodError(ServiceMethod.java:752) at retrofit2.ServiceMethod$Builder.methodError(ServiceMethod.java:743) at retrofit2.ServiceMethod$Builder.parameterError(ServiceMethod.java:761) at retrofit2.ServiceMethod$Builder.parseParameter(ServiceMethod.java:351) at retrofit2.ServiceMethod$Builder.build(ServiceMethod.java:204) at retrofit2.Retrofit.loadServiceMethod(Retrofit.java:170) at retrofit2.Retrofit$1.invoke(Retrofit.java:147) at java.lang.reflect.Proxy.invoke(Proxy.java:813) at $Proxy0.savePost(Unknown Source) at com.example.developer_4.test_log.LoginActivity.sendPost(LoginActivity.java:135) at com.example.developer_4.test_log.LoginActivity$2.onClick(LoginActivity.java:108) at android.view.View.performClick(View.java:5637) at android.view.View$PerformClick.run(View.java:22429) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6119) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) resulted line:
mAPIService.savePost(id, password).enqueue(new Callback<LoginRequest>() You can see my previous questions, and it seems that I started to work a little, but now I'm confused and there are problems with converting data from input fields into json. If anyone knows how to help me I will be very grateful.
@POST("/{login}/{password}")- correct this to the correct login path or add the corresponding parameters with the annotation@Path- woesssbaseUrl- that is, if.baseUrl("http://exemple.com"), and the request address ishttp://exemple.com/v1/login, the path will be@POST("/v1/login")- woesss