I have added a Google Cloud backend module to my app. It worked fine till yesterday. After that it suddenly refused to recognize any change I make to the backend classes. For example, I have a model class "Match" in my backend which had methods like setId, getId etc. In the app module, I had imported the Match class and used it's methods as well. Then yesterday, I added a new method to this class, "getText". But this method didn't show up in the app module auto-complete and showed "cannot resolve symbol 'getText'" error if I try to forcefully use this. I thought it may be a sync issue, so I did the following (many times in different orders):
- Build Project
- Clean Project
- Run backend
- Deploy backend to GAE project
- Sync project with Gradle files
- Invalidate caches/Restart...
- removed and added again the import statement for Match class and then did a rebuild
- Created a fresh project from scratch, added a backend and did the same things with default "MyBean" class. Again, it will recognize only the pre-existing methods and no new method I want to add
But the code is unyielding. It seems that the backend classes that the respective app modules are referring to, somehow froze in time. Even if I comment out some of the methods in the Match class, and then rebuild the project, those methods still appear in the app module.
I am using Android Studio 2.1 by the way.
Now just banging my head to the wall.
From the sounds of it, I had this same issue. What I found out in the end is that the front end of the project only gets
getters
andsetters
from the backend. Thosegetters
andsetters
are based on the members of the class on the backend. I'm guessing that you don't have a member in classMatch
calledtext
, which is whygetText()
never worked. Also, I bet you deleted/commented out some of the other methods, but didn't remove the corresponding members from the class. Because those members were still there, the frontend class that is compiled createsgetters
andsetters
for them.I don't have any documentation on this at hand, but I've learned to think about the backend classes as json strings that are passed to the front end. Whatever members are there will can be accessed via
getter
/setter
on the front end, but that is it. Any other functions you build are backend access only.