简体   繁体   English

将包装对象从Android发送到Google云端点时出错

[英]Error sending wrapper object from Android to Google cloud endpoints

I have been able to send data from Android to endpoint successfully, but now I am having a problem with trying to send a wrapper object to the endpoint from Android. 我已经能够成功地将数据从Android发送到端点,但是现在我尝试从Android将包装对象发送到端点时遇到了问题。 The error is: 错误是:

actual and formal argument lists differ in length

I didn't use an @named annotation, is that the problem? 我没有使用@named注释,这是问题吗? Because all explanations of using a wrapper class show that is should be left out? 因为使用包装器类的所有说明都表明应该省略?

I created a custom class, as the wrapper eg: 我创建了一个自定义类,作为包装器,例如:

public class ObjectHolder {

    private int b_holder;
    ...etc

    public int getB_holder() {
        return b_holder;
    }

    public void setB_holder(int b_holder) {
        this.b_holder = b_holder;
    }

    ...etc
}

Error point!! 错误点! objectholder shows error when trying to rebuild project in android studio. 尝试在android studio中重建项目时, objectholder显示错误。 Call endpoint from android: 从android调用端点:

 PObject save = myApiService.getPObject(objectholder).execute();

Endpoint: 终点:

@ApiMethod(name = "getObject")
public PObject getPObject(ObjectHolder ObjectHolder) {

Should the ObjectHolder be within the endpoint package or android package, or both? ObjectHolder应该在端点包中还是在android包中,或者两者都在? I currently have tried all three options. 我目前已经尝试了所有三个选项。 I get errors for all three. 我对这三个都有错误。

Not much info to work on, but my guess is you are trying to implement wrapper yourself. 没有太多要处理的信息,但是我猜您正在尝试自己实现包装器。

The ObjectHolder wrapper is created for you when you generate the client libs. 当您生成客户端库时,将为您创建ObjectHolder包装器。 You should use the provided implementation. 您应该使用提供的实现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM