简体   繁体   English

Google Cloud Module中的后端端点类未更新(Android)

[英]Backend Endpoint Class in Google Cloud Module not Updating (Android)

I have a class which is used to generate endpoints to the save in Google Cloud Datastore. 我有一个用于生成端点以保存到Google Cloud Datastore中的端点的类。 I populate objects of this class on the application side and then call the generated API to store them (I'm using Objectify) 我在应用程序端填充此类的对象,然后调用生成的API来存储它们(我正在使用Objectify)

I've recently added a new field of type List<String> including a method to add strings to the list. 我最近添加了一个类型为List<String>的新字段,其中包括一种将字符串添加到列表的方法。 However on the application said I can only see the old version of the class (which is imported from backend.MyApi.model.MyClass ) 但是在应用程序上说我只能看到该类的旧版本(该类是从backend.MyApi.model.MyClass导入的)

The culprit according to Android Studio is in backend/build/libs/backend-android-endpoints.jar which has a MyClass.class object 根据Android Studio的原因是在backend / build / libs / backend-android-endpoints.jar中,该对象具有MyClass.class对象

I've tried deleting the build files in the backend module, cleaning and rebuilding but it still uses the old version 我尝试删除后端模块中的构建文件,进行清理和重建,但是它仍然使用旧版本

How do I force the class to be rebuilt using the new source to include the new fields/methods? 如何强制使用新的源来重建类以包含新的字段/方法?

So I think I've found the solution. 所以我想我已经找到了解决方案。

Any class defined as an entity by Objectify shows up in API.model but only with getters and setters for its defined fields. 由Objectify定义为实体的任何类都显示在API.model中,但其定义字段仅具有getter和setter。 Therefore my add method isn't part of it 因此,我的添加方法不属于其中

Therefore to include the functionality of add() instead on the application side I write 因此,我在应用程序端add()的功能,

List<String> classList = classInstance.getClassList();
String stringToAdd = "Blah";
if (!classList.contains(stringToAdd))
{
    classList.add(stringToAdd);
    classInstance.setClassList(classList)
}

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

相关问题 我的后端API名称是什么? 它在哪里? 从Android Studio客户端调用Google Cloud端点后端API - What is my backend API name? Where is it? Calling Google Cloud endpoint backend API from Android Studio Client 如何在android中捆绑google cloud端点消息类 - How to Bundle google cloud endpoint message class in android Google Cloud Endpoint后端 - 是否可以检索HttpSession的属性? - Google Cloud Endpoint Backend - Is it possible to retrieve attributes of the HttpSession? 适用于无状态后端应用程序的Google App Cloud Endpoint API - Google App Cloud Endpoint API for Stateless Backend App Android上的Google Cloud Endpoint非法参数异常 - Google Cloud Endpoint Illegal Argument exception on Android Google Cloud Endpoint可以在Google APIs Explorer中工作,但不能在Android上工作(错误请求) - Google Cloud Endpoint work in Google APIs Explorer but not on Android (Bad Request) 无法在Google Cloud Endpoints中创建Endpoint类中的方法 - Cannot create more than a method in Endpoint class in Google Cloud Endpoints 如何将后端模块类导入android studio中的app模块 - How to import a backend module class into an app module in android studio Google Cloud Endpoint不在端点列表中创建Api - Google Cloud Endpoint Not Creating Api in Endpoint List Google Cloud Endpoint Bucket下载器 - Google Cloud Endpoint Bucket Downloader
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM