SimpleXML:构造函数异常

SimpleXML : ConstructorException

我正在尝试像这样解析一些 RSS 2.0 提要: https://audioboom.com/channels/4682117.rss

我的模型是这样的

Rss Class(Java 文件,Kotlin 也给我带来了麻烦)

@Root(name = "rss", strict = false)
@Namespace(prefix = "itunes", reference = "http://www.itunes.com/dtds/podcast-1.0.dtd")
public class RSSFeed {

    @Element(name = "title", required = false)
    @Path("channel")
    public String channelTitle = null;

    @Element(name = "description", required = false)
    @Path("channel")
    public String description = null;

    @Element(name = "url", required = false)
    @Path("channel/image")
    String imageUrl = null;

    @ElementList(name = "item", inline = true, required = false)
    @Path("channel")
    public List<Article> articleList = null;
}

项目Class(Kotlin 文件)

@Root(name = "item", strict = false)
@Namespace(prefix = "itunes", reference = "http://www.itunes.com/dtds/podcast-1.0.dtd")
class Article{

    @set:Path("title")
    @get:Path("title")
    @set:Text(required = false)
    @get:Text(required = false)
    var title: String? = null

    @set:Element(name = "link", required = false)
    @get:Element(name = "link", required = false)
    var url: String? = null

    @set:Element(name = "enclosure", required = false)
    @get:Element(name = "enclosure", required = false)
    var enclosure: Enclosure? = null

    @set:Element(name = "guid", required = false, data = true)
    @get:Element(name = "guid", required = false, data = true)
    var id: String? = null

    @set:Namespace(reference = "http://www.itunes.com/dtds/podcast-1.0.dtd")
    @get:Namespace(reference = "http://www.itunes.com/dtds/podcast-1.0.dtd")
    @set:Element(name = "image", required = false)
    @get:Element(name = "image", required = false)
    var image: Image? = null

    @set:Namespace(reference = "http://www.itunes.com/dtds/podcast-1.0.dtd")
    @get:Namespace(reference = "http://www.itunes.com/dtds/podcast-1.0.dtd")
    @set:Element(name = "duration", required = false)
    @get:Element(name = "duration", required = false)
    var duration: String? = null

    fun getEpisodeUrl(): String? = enclosure?.url ?: url
}

自从我启用了Progaurd。我开始收到此错误:

java.lang.RuntimeException: org.simpleframework.xml.core.ConstructorException: Default constructor can not accept read only @org.simpleframework.xml.Element(data=false, name=duration, required=false, type=void) on method 'duration' in class com.myapp.model.rss.Article

我从 here

得到了正确的混淆器配置
# SimpleXML
# Save the obfuscation mapping to a file, so we can de-obfuscate any stack
# traces later on. Keep a fixed source file attribute and all line number
# tables to get line numbers in the stack traces.
# You can comment this out if you're not interested in stack traces.

-printmapping out.map
-keepparameternames
-renamesourcefileattribute SourceFile
-keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,EnclosingMethod

# Preserve all annotations.

-keepattributes *Annotation*

# Add optimizations

-allowaccessmodification
-optimizationpasses 3

# Preserve all public classes, and their public and protected fields and
# methods.

-keep public class * {
    public protected *;
}

# Preserve all .class method names.

-keepclassmembernames class * {
    java.lang.Class class$(java.lang.String);
    java.lang.Class class$(java.lang.String, boolean);
}

# Preserve all native method names and the names of their classes.

-keepclasseswithmembernames class * {
    native <methods>;
}

# Preserve the special static methods that are required in all enumeration
# classes.

-keepclassmembers class * extends java.lang.Enum {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

# Explicitly preserve all serialization members. The Serializable interface
# is only a marker interface, so it wouldn't save them.
# You can comment this out if your library doesn't use serialization.
# If your code contains serializable classes that have to be backward
# compatible, please refer to the manual.

-keepclassmembers class * implements java.io.Serializable {
    static final long serialVersionUID;
    static final java.io.ObjectStreamField[] serialPersistentFields;
    private void writeObject(java.io.ObjectOutputStream);
    private void readObject(java.io.ObjectInputStream);
    java.lang.Object writeReplace();
    java.lang.Object readResolve();
}

# Your library may contain more items that need to be preserved;
# typically classes that are dynamically created using Class.forName:

-keep interface org.simpleframework.xml.core.Label {
   public *;
}
-keep class * implements org.simpleframework.xml.core.Label {
   public *;
}
-keep interface org.simpleframework.xml.core.Parameter {
   public *;
}
-keep class * implements org.simpleframework.xml.core.Parameter {
   public *;
}
-keep interface org.simpleframework.xml.core.Extractor {
   public *;
}
-keep class * implements org.simpleframework.xml.core.Extractor {
   public *;
}

-dontwarn com.bea.xml.stream.**
-dontwarn org.simpleframework.xml.stream.**
-keep class org.simpleframework.xml.**{ *; }
-keepclassmembers,allowobfuscation class * {
    @org.simpleframework.xml.* <fields>;
    @org.simpleframework.xml.* <init>(...);
}