Search code examples
androidparceler

Parceler - Unable to find generated Parcelable class


EDIT

After clean and rebuilt, classes are not generated


I got this error while trying to use Parcels.wrap()

Unable to find generated Parcelable class for xyz.xyz.models.reclamation.Reclamation, verify that your class is configured properly and that the Parcelable class xyz.xyz.models.reclamation.Reclamation$$Parcelable is generated by Parceler.

But Reclamation$$Parcelable class is created and I can see its content.

Thats my gradle:

compile 'org.parceler:parceler-api:1.1.6'
annotationProcessor 'org.parceler:parceler:1.1.6'

Trying to change annotationProcessor to apt causes build error.

Thats Reclamation class

@Parcel
public class Reclamation {

public Reclamation() {
}

private int reclamationProductID;

private Integer preference;

private String takingDate1;

private String takingDate2;

private int takingAddressID;

private String takingAddressStreet;

private String takingAddressCity;

private String takingAddressZipCode;

private int type;

private String takingAddressCompany;
// + getters setters
}

Thats the line where it crashes

ServiceStepFour_.builder().arg(Constants.ARG_RECLAMATION, Parcels.wrap(reclamation)).build();

I use it in combination with Android Annotations.

Does anybody know why this happens?


Solution

  • Although documentation says you have to put these lines to the gradle:

    compile 'org.parceler:parceler-api:1.1.6'
    annotationProcessor 'org.parceler:parceler:1.1.6'
    

    change it to:

    compile 'org.parceler:parceler-api:1.1.6'
    apt 'org.parceler:parceler:1.1.6'
    

    Make sure all files you want to use are annotated with @Parcel.

    I have class A with class B variable and I forgot to annotate class B. That's why changing from annotationProcessor to apt gaves me an build error.