简体   繁体   中英

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. I populate objects of this class on the application side and then call the generated API to store them (I'm using Objectify)

I've recently added a new field of type List<String> including a method to add strings to the list. However on the application said I can only see the old version of the class (which is imported from 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

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. Therefore my add method isn't part of it

Therefore to include the functionality of add() instead on the application side I write

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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