Note that there are some explanatory texts on larger screens.

plurals
  1. POGWT and Android communication. Enum serialization issue
    primarykey
    data
    text
    <p>I have a perfectly working GWT application. Now I am trying to use <a href="https://code.google.com/p/gwt-syncproxy/" rel="nofollow"><code>gwt-syncproxy</code></a> to create an Android client which can simply reuse the server side code.</p> <p>So far everything was working perfectly. The only problem that I can find is when I start RPC to a method expecting an enum as a parameter.</p> <p>The enum looks something like this:</p> <pre><code>import java.io.Serializable; import com.google.gwt.user.client.rpc.IsSerializable; public enum ReferenceTable implements IsSerializable, Serializable { basetable, othertable; ReferenceTable(){} } </code></pre> <p>The error message I'm getting is:</p> <pre><code>com.google.gwt.user.client.rcp.IncompatibleRemoteServiceException: Invalid type signature for package.ReferenceTable </code></pre> <p>which suggests that it's a problem related to serialization.</p> <p>I tried using different combinations of <code>IsSerializable</code> and <code>Serializable</code> and always cleaned the project before deploying. Both the GWT app and the Android app use the <em>same</em> code for the data types used for communication.</p> <p>Does anyone have an idea how to solve this? If nothing else works, I <em>could</em> refrain from using enums, but I would prefer using them. Especially, since everything is working for the GWT server-client communication itself.</p> <hr> <p>BTW: The error on the server side is:</p> <pre><code>Caused by: com.google.gwt.user.client.rpc.SerializationException: Invalid type signature for some.package.ReferenceTable at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.validateTypeVersions(ServerSerializationStreamReader.java:1116) at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.deserialize(ServerSerializationStreamReader.java:610) at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.readObject(ServerSerializationStreamReader.java:567) at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader$ValueReader$8.readValue(ServerSerializationStreamReader.java:140) at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.deserializeValue(ServerSerializationStreamReader.java:425) at com.google.gwt.user.server.rpc.RPC.decodeRequest(RPC.java:312) ... 24 more </code></pre> <p><strong>EDIT</strong>:</p> <p>I created both a sample GWT app and a sample Android app, so people can actually try the code:</p> <ul> <li><a href="https://dl.dropboxusercontent.com/u/498403/EnumProject.zip" rel="nofollow">GWT part</a></li> <li><a href="https://dl.dropboxusercontent.com/u/498403/EnumProjectAndroid.zip" rel="nofollow">Android part</a></li> </ul> <p>To deploy the app, just modify the <code>build.properties</code> file and then run <code>build.xml</code> as an ant script. In the <code>MainActivity</code> of the Android app, modify the URL to point to the GWT app.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload