编辑
在清理和重新生成类之后,将不会生成类。
我在尝试使用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.但是创建了Reclamation$$Parcelable类,我可以看到它的内容。
那是我的秤:
compile 'org.parceler:parceler-api:1.1.6'
annotationProcessor 'org.parceler:parceler:1.1.6'试图将annotationProcessor更改为apt会导致生成错误。
那是填海课
@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
}那是它崩溃的地方。
ServiceStepFour_.builder().arg(Constants.ARG_RECLAMATION, Parcels.wrap(reclamation)).build();我将它与Android注释结合使用。
有人知道为什么会这样吗?
发布于 2017-02-22 09:43:43
尽管文档中说,您必须将这些行放到gradle中:
compile 'org.parceler:parceler-api:1.1.6'
annotationProcessor 'org.parceler:parceler:1.1.6'改为:
compile 'org.parceler:parceler-api:1.1.6'
apt 'org.parceler:parceler:1.1.6'确保要使用的所有文件都带有@Parcel注释。
我有一个带有B类变量的A类,我忘了注释B类,这就是为什么从annotationProcessor更改为apt会给我带来一个构建错误。
发布于 2017-03-09 20:18:33
在我的例子中,当我从apt移到时,我必须删除这一行
apply plugin: 'com.neenbedankt.android-apt'发布于 2022-11-17 13:24:40
我知道这是个迟来的答案,但也许其他人稍后会有这个问题,
如果在代码中使用Kotlin,则必须使用kapt而不是annotationProcessor来解决问题。
apply plugin: 'kotlin-kapt'
dependencies {
kapt 'org.parceler:parceler:1.1.12'
}https://stackoverflow.com/questions/42386485
复制相似问题