Q:

IllegalArgumentException: expected primitive class, but got: class UUID

My app is using GAE endpoints. My model has UUID. And once i try to send it Android app it encounters illegalArgument exception. 
Anyone has got recommendations how to handle endpoints model with UUID on android app with Google App Engine endpoints?
 06-14 23:26:49.560  27462-27488/com.example E/AndroidRuntime﹕ FATAL EXCEPTION: AsyncTask #1
    Process: com.example, PID: 27462
    java.lang.RuntimeException: An error occured while executing doInBackground()
            at android.os.AsyncTask$3.done(AsyncTask.java:300)
            at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
            at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
            at java.util.concurrent.FutureTask.run(FutureTask.java:242)
            at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at java.lang.Thread.run(Thread.java:818)
     Caused by: java.lang.IllegalArgumentException: key id
            at com.google.api.client.json.JsonParser.parseValue(JsonParser.java:880)
            at com.google.api.client.json.JsonParser.parse(JsonParser.java:381)
            at com.google.api.client.json.JsonParser.parse(JsonParser.java:354)
            at com.google.api.client.json.JsonObjectParser.parseAndClose(JsonObjectParser.java:87)
            at com.google.api.client.json.JsonObjectParser.parseAndClose(JsonObjectParser.java:81)
            at com.google.api.client.http.HttpResponse.parseAs(HttpResponse.java:459)
            at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460)
            at com.example.CustomAsyncTask.doInBackground(CustomAsyncTask.java:30)
            at com.example.CustomAsyncTask.doInBackground(CustomAsyncTask.java:15)
            at android.os.AsyncTask$2.call(AsyncTask.java:288)
            at java.util.concurrent.FutureTask.run(FutureTask.java:237)
            at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at java.lang.Thread.run(Thread.java:818)
     Caused by: java.lang.IllegalArgumentException: key id, field private com.example.customApi.model.UUID com.example.customApi.model.Survey.id
            at com.google.api.client.json.JsonParser.parseValue(JsonParser.java:880)
            at com.google.api.client.json.JsonParser.parse(JsonParser.java:471)
            at com.google.api.client.json.JsonParser.parseValue(JsonParser.java:780)
            at com.google.api.client.json.JsonParser.parse(JsonParser.java:381)
            at com.google.api.client.json.JsonParser.parse(JsonParser.java:354)
            at com.google.api.client.json.JsonObjectParser.parseAndClose(JsonObjectParser.java:87)
            at com.google.api.client.json.JsonObjectParser.parseAndClose(JsonObjectParser.java:81)
            at com.google.api.client.http.HttpResponse.parseAs(HttpResponse.java:459)
            at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460)
            at com.example.CustomAsyncTask.doInBackground(CustomAsyncTask.java:30)
            at com.example.CustomAsyncTask.doInBackground(CustomAsyncTask.java:15)
            at android.os.AsyncTask$2.call(AsyncTask.java:288)
            at java.util.concurrent.FutureTask.run(FutureTask.java:237)
            at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at java.lang.Thread.run(Thread.java:818)
     Caused by: java.lang.IllegalArgumentException: **expected primitive class, but got: class com.example.customApi.model.UUID**
            at com.google.api.client.util.Data.parsePrimitiveValue(Data.java:444)
            at com.google.api.client.json.JsonParser.parseValue(JsonParser.java:850)
            at com.google.api.client.json.JsonParser.parse(JsonParser.java:471)
            at com.google.api.client.json.JsonParser.parseValue(JsonParser.java:780)
            at com.google.api.client.json.JsonParser.parse(JsonParser.java:381)
            at com.google.api.client.json.JsonParser.parse(JsonParser.java:354)
            at com.google.api.client.json.JsonObjectParser.parseAndClose(JsonObjectParser.java:87)
            at com.google.api.client.json.JsonObjectParser.parseAndClose(JsonObjectParser.java:81)
            at com.google.api.client.http.HttpResponse.parseAs(HttpResponse.java:459)
            at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460)
            at com.example.CustomAsyncTask.doInBackground(CustomAsyncTask.java:30)
            at com.example.CustomAsyncTask.doInBackground(CustomAsyncTask.java:15)
            at android.os.AsyncTask$2.call(AsyncTask.java:288)
            at java.util.concurrent.FutureTask.run(FutureTask.java:237)
            at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at java.lang.Thread.run(Thread.java:818)

My Custom class Endpoint is returning to Android:
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

import java.util.UUID;

@DatabaseTable
public class CustomClass {

    @DatabaseField(generatedId = true)
    UUID id;

    @DatabaseField
    String title;

    public CustomClass() {
        //nothing
    }

    public UUID getId() {
        return id;
    }

    public void setId(UUID id) {
        this.id = id;
    }

    }

My endpoint code:
import java.util.UUID;

import javax.inject.Named;

/**
 * An endpoint class we are exposing
 */
@Api(
        name = "customApi",
        version = "v1",
        resource = "customr",
        namespace = @ApiNamespace(
                ownerDomain = "xyz",
                ownerName = "xyz",
                packagePath = ""
        )
)
public class customClassEndpoint  {

    @ApiMethod(
            name = "insertCustom",
            scopes = "profile",
            clientIds = {"xx"},
            audiences = {"xx"}
    )
    public CustomClass insertcustomClass(CustomClass customClass, com.google.appengine.api.users.User authUser ) throws ConflictException, OAuthRequestException {
        logger.info("Calling insertcustomClass method");
        //persisting        customClass which assigns UUID
        return customClass;
    }

}

A:

I do understand why Google Api JSON parser was attempting to parse UUID as primitive, but at least I found a workaround to this issue. 
In my model class I kept field as UUID but changed getter to return String, now it looks like this:
public String getId() {
      return id.toString(); 
}

and it has solved the issue for me.

