3

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?

kristyna
  • 1,360
  • 2
  • 24
  • 41

3 Answers3

4

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.

kristyna
  • 1,360
  • 2
  • 24
  • 41
1

In my case, I have to remove this line when I move from apt to annotationProcessor

apply plugin: 'com.neenbedankt.android-apt'
nizam.sp
  • 4,002
  • 5
  • 39
  • 63
1

I know this is a late answer but maybe someone else has this issue later,

If you are using Kotlin in your code you must use kapt instead of annotationProcessor to solve the issue

apply plugin: 'kotlin-kapt'

dependencies {
    kapt 'org.parceler:parceler:1.1.12'
}
Mahdi Javaheri
  • 1,080
  • 13
  • 25