vsch/flexmark-java

com.vladsch.flexmark.util.data.DataKey$$ExternalSyntheticLambda2

buianhtai1205 opened this issue · 2 comments

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.appbanlaptop, PID: 8706
java.lang.NoClassDefFoundError: com.vladsch.flexmark.util.data.DataKey$$ExternalSyntheticLambda2
at com.vladsch.flexmark.util.data.DataKey.(DataKey.java:69)
at com.vladsch.flexmark.util.data.SharedDataKeys.(SharedDataKeys.java:10)
at com.vladsch.flexmark.parser.Parser.(Parser.java:37)
at com.appbanlaptop.fragment.LaptopDetailFragment.onCreateView(LaptopDetailFragment.java:114)
at androidx.fragment.app.Fragment.performCreateView(Fragment.java:3104)
at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:524)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:261)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1899)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1823)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1760)
at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:547)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

I'm use implementation 'com.vladsch.flexmark:flexmark-all:0.64.0' and i meet this error
Code java:
MutableDataSet options = new MutableDataSet();
Parser parser = Parser.builder(options).build();
HtmlRenderer renderer = HtmlRenderer.builder(options).build();
Node document = parser.parse("This is Sparta");
String html = renderer.render(document);
System.out.println(html);

I am facing the same issue. The error occurs on Android with API below 24.

The code of the lib on line 69 of DataKey.java is not the simplest one:

    public DataKey(@NotNull String name, @NotNull T defaultValue) {
        this(name, defaultValue, options -> defaultValue);
    }

My best guess is that this kind of Lamdda is not supported below API 24. A lot of functional stuff was added in API 24. See e.g. https://developer.android.com/reference/java/util/function/Supplier: "Added in API level 24".

If this is confirmed, it might be useful, to mention this in the README.md's Android section.