Java.lang.IllegalArgumentException: Die Antwort muss einen generischen Typ enthalten (z. B. Response).Java

Java-Forum
Guest
 Java.lang.IllegalArgumentException: Die Antwort muss einen generischen Typ enthalten (z. B. Response).

Post by Guest »

Fehler, wenn ich einen Chat an andere sende.

Code: Select all

java.lang.IllegalArgumentException: Response must include generic type (e.g., Response)
for method APIService.sendnotif

at retrofit2.Utils.methodError(Utils.java:54)

at retrofit2.Utils.methodError(Utils.java:43)

at retrofit2.HttpServiceMethod.parseAnnotations(HttpServiceMethod.java:77)

at retrofit2.ServiceMethod.parseAnnotations(ServiceMethod.java:39)
at retrofit2.Retrofit.loadServiceMethod(Retrofit.java:202)
at retrofit2.Retrofit$1.invoke(Retrofit.java:160)
at java.lang.reflect.Proxy.invoke(Proxy.java:1006)
at $Proxy0.sendnotif(Unknown Source)
at com.azizah.msocial.ChatAct$7.onDataChange(ChatAct.java:297)
Klassenschnittstelle ApiService

Code: Select all

public interface APIService {

@Headers({
"Content-Type:application/json",
"Authorization:key=Lhghhkvhvhffgv"
})

@POST("fcm/send")
Call sendnotif(@Body Pengirim body);
}
sendnotif.class
ERROR in line apiService.sendnotif
muss hier einen generischen Typ enthalten. Können Sie mir erklären, wie ich eine generische Nachrüstung durchführen soll?

Code: Select all

private void sendnotif(final String hisUid, final String name, final String pesan) {

DatabaseReference alltoken = FirebaseDatabase.getInstance().getReference("Tokens");
Query query = alltoken.orderByKey().equalTo(hisUid);
query.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {

for(DataSnapshot ds: dataSnapshot.getChildren()){
Tokenclass tokenclass = ds.getValue(Tokenclass.class);
Datanotif data = new Datanotif(myUid, name+":"+pesan, "Pesan Baru", hisUid, R.drawable.ic_usr_name);
Pengirim pengirim = new Pengirim(data, tokenclass.getToken());
apiService.sendnotif(pengirim)
.enqueue(new Callback() {
@Override
public void onResponse(Call call, Response response) {
Toast.makeText(ChatAct.this, ""+response.message(), Toast.LENGTH_SHORT).show();
}

@Override
public void onFailure(Call call, Throwable t) {

}
});
}
}

@Override
public void onCancelled(@NonNull DatabaseError databaseError) {

}
});

}
Fehler in apiService.sendnotif(pengirim)

Bitte helfen Sie mir, dadurch wird das Schließen der App erzwungen

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post