Sto facendo android, cercando un modo per fare una richiesta HTTP GET/POST super base. Continuo a ricevere un errore:Come ottenere una risposta stringa da Retrofit2?
java.lang.IllegalArgumentException: Unable to create converter for class java.lang.String
Webservice:
public interface WebService {
@GET("/projects")
Call<String> jquery();
}
poi nella mia java:
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://jquery.org")
// .addConverterFactory(GsonConverterFactory.create())
.build();
WebService service = retrofit.create(WebService.class);
Call<String> signin = service.jquery();
Toast.makeText(this, signin.toString(), Toast.LENGTH_LONG).show();
Sto letteralmente solo cercando di interrogare jquery.org/projects con un GET richiedi e restituisci la stringa con cui risponde. Che c'è?
Se provo a implementare un convertitore personalizzato (ho trovato alcuni esempi in linea) si lamenta che non ho implementato il metodo astratto convert (F), che nessuno degli esempi fa.
Grazie.
Qual è collaboratore? Non riesce a trovarlo. –
L'ho modificato È ResponseBody e altre modifiche sono body(). Stringa() – uguboz