简体   繁体   中英

java.lang.TypeNotPresentException

I'm using a fiew webservices that return an object but not a standard type object, it's an object of my own classes, for example:

public class BaseResponse {
    public String ErrorMessage;
    public String ResponseStatus;
    public String ResponseDate;
    public String SessionExpire;
}

public class ResponseJsonModel extends BaseResponse{
    private String firstName;
    private String lastName;
    private boolean male;
    private Address address;
    ...
}

NOTE: BaseResponse is a standard types object.
Everything works fine except when I use proguard because it throws:

java.lang.TypeNotPresentException: Type com.myapp.ResponseJsonModel not present


I've found an issue similar to mine: http://code.google.com/p/google-api-java-client/issues/detail?id=527 but the solution doesn't work, I'm still having the same exception even if I use:

 -keep class com.google.api.client.googleapis.json.GoogleJsonError$ErrorInfo

as mentioned in the issue...

I've read somewhere in the web that I should annotate such classes with various JAXB annotations. Could this be the solution? I know nothing about JAXB.

Thanks for your time.

I've added a line to proguard-project.txt -keep class <com.myapp.modelsfolder>** {*;} and now the exception is not thrown.

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