If you try to use this library in android, because the android implementation of java.beans does not include everything, it breaks and gives rise to error messages like this:
03-20 13:25:05.337 3798 3798 E AndroidRuntime: FATAL EXCEPTION: main
03-20 13:25:05.337 3798 3798 E AndroidRuntime: Process: net.osmand.osmandapidemo, PID: 3798
03-20 13:25:05.337 3798 3798 E AndroidRuntime: java.lang.NoClassDefFoundError: Failed resolution of: Ljava/beans/PropertyDescriptor;
03-20 13:25:05.337 3798 3798 E AndroidRuntime: at nostr.event.BaseTag.getFieldValue(BaseTag.java:62)
03-20 13:25:05.337 3798 3798 E AndroidRuntime: at nostr.event.BaseTag.getSupportedFields(BaseTag.java:73)
03-20 13:25:05.337 3798 3798 E AndroidRuntime: at nostr.event.json.serializer.TagSerializer.serialize(TagSerializer.java:40)
03-20 13:25:05.337 3798 3798 E AndroidRuntime: at nostr.event.json.serializer.TagSerializer.serialize(TagSerializer.java:26)
...
03-20 13:25:05.337 3798 3798 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "java.beans.PropertyDescriptor" on path: DexPathList[[zip file "/data/app/~~9-WjRr1mUHHEGYfuUBz3qQ==/net.osmand.osmandapidemo-J2NUIjPW7E9uetAiZejkcA==/base.apk"],nativeLibraryDirectories=[/data/app/~~9-WjRr1mUHHEGYfuUBz3qQ==/net.osmand.osmandapidemo-J2NUIjPW7E9uetAiZejkcA==/lib/arm64, /system/lib64, /system_ext/lib64]]
I was able to solve this problem with the following diff:
diff --git a/nostr-java-event/pom.xml b/nostr-java-event/pom.xml
index bda88c8..142ffc6 100644
--- a/nostr-java-event/pom.xml
+++ b/nostr-java-event/pom.xml
@@ -20,6 +20,11 @@
</dependency>
<!-- Project Dependencies -->
+ <dependency>
+ <groupId>me.champeau.openbeans</groupId>
+ <artifactId>openbeans</artifactId>
+ <version>1.0.2</version>
+ </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>nostr-java-base</artifactId>
diff --git a/nostr-java-event/src/main/java/module-info.java b/nostr-java-event/src/main/java/module-info.java
index c8ed2e4..13093ae 100644
--- a/nostr-java-event/src/main/java/module-info.java
+++ b/nostr-java-event/src/main/java/module-info.java
@@ -9,6 +9,7 @@ module nostr.event {
requires nostr.util;
requires java.logging;
requires java.desktop;
+ requires openbeans;
exports nostr.event;
exports nostr.event.impl;
diff --git a/nostr-java-event/src/main/java/nostr/event/BaseTag.java b/nostr-java-event/src/main/java/nostr/event/BaseTag.java
index 527c55e..6565347 100644
--- a/nostr-java-event/src/main/java/nostr/event/BaseTag.java
+++ b/nostr-java-event/src/main/java/nostr/event/BaseTag.java
@@ -3,8 +3,8 @@ package nostr.event;
import com.fasterxml.jackson.annotation.JsonIgnore;^M
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;^M
import com.fasterxml.jackson.databind.annotation.JsonSerialize;^M
-import java.beans.IntrospectionException;^M
-import java.beans.PropertyDescriptor;^M
+import com.googlecode.openbeans.IntrospectionException;^M
+import com.googlecode.openbeans.PropertyDescriptor;^M
import java.lang.reflect.Field;^M
import java.lang.reflect.InvocationTargetException;^M
import java.util.ArrayList;^M
Related issue:
powermock/powermock@dafc04a
If you try to use this library in android, because the android implementation of java.beans does not include everything, it breaks and gives rise to error messages like this:
I was able to solve this problem with the following diff:
Related issue:
powermock/powermock@dafc04a