我有一个核心分支,其中以下依赖项是十进制的
implementation "org.parceler:parceler-api:$rootProject.ext.parcelVersion"
annotationProcessor "org.parceler:parceler:$rootProject.ext.parcelVersion"我在我的一个库模块中声明一个依赖项,如下所示
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':core')
}下面是我将在活动中打包的类
@Parcel(parcelsIndex = false)
public class MyClass {
@SerializedName("validation")
public String myField;
}异常在第三行抛出。
MyClass myClass = new MyClass();
myClass.myField = "bjbskas";
Parcelable parcelable =Parcels.wrap(myClass);异常读数如下所示
Unable to find generated Parcelable class for com.example.mylibrary.MyClass,
verify that your class is configured properly and that the Parcelable class
com.example.mylibrary.MyClass$$Parcelable is generated by Parceler.如果我尝试将parceler库直接放入我的库模块中,它会给出另一个错误,称为
Program type already present: org.parceler.Parceler$$Parcels$1发布于 2019-07-29 19:51:48
将Parceler库的版本从1.0.4改为1.1.10,解决了这个问题。我不知道这背后的原因是什么,但我猜这可能是因为使用版本1.1.10的一些传递依赖
https://stackoverflow.com/questions/57236568
复制相似问题