Closed fauzi2107 closed 5 years ago
Because there is no jar in a public repository yet, you'll need to download this project and build the jar yourself with ./gradlew clean build
. That will create a jar file for you. Copy that jar file into your Android project and then add a dependency to your build.gradle file such as implementation file('./json-logic-java.jar')
(you will need to change the path).
Then you can evaluate the logic using the classes:
String responseFromServer = /* get response from server somehow */;
JsonLogic jsonLogic = new JsonLogic();
Object result = jsonLogic.apply(responseFromServer);
i used the jar file, but i alway get error java.lang.NoClassDefFoundError: io.github.jamsesso.jsonlogic.evaluator.expressions.-$$Lambda$MathExpression$6LV1d7b2Zie4tBnt_sPJGZEjXKk
Can you provide a stripped-down project that reproduces the issue?
Closing this issue due to inactivity.
The problem that @fauzi2107 reported is linked to the fact that this library uses Java 8 features and that they were trying to run it on an Android device with Android 6.0 or lower. Java 8 was introduced in Android 7.0 (API level 24).
The confusing NoClassDefFoundError
exception that is thrown is because the class MathExpression
is considered to be in an erroneous state, as explained in this SO answer.
There are, therefore, 2 solutions to this problem:
Hi, i still new with this type of json in android, so if i receive json from backend like this
{ "if": [ { "==": [ { "var": "is_informan" }, "1" ] }, { "field": "id", "value": "", "reference": "step2-id" }, { "field": "name", "value": "", "reference": "step2-name" } ] }
how can i handle it with your project? sorry if this to much,