Use freemarker library in android
I am trying to use the freemarker library in my project, but I am getting an error while initializing the Configuration object.
I researched this question and found this link. I tried to apply the patch mentioned in the link above, but I was unable to apply it successfully.
Can anyone use Freemarker in Android please help?
source to share
Problem:
Even though Freemarker does not officially support Android, it published a special * .jars for GAE to provide some support, and many other Android solutions could successfully use Freemarker in their application (either rendering the view / code, or just evaluating some expressions ).
Cause:
The root cause of the problem is that Freemarker will use several things from a package java.beans
that for some reason is not included in the core Android libraries.
According to the answer on Stackoverflow (/ questions / 15065545 / using-jars-that-use-java-beans -classes-introspector-beaninfo-ordesdescri), this is an Android flaw, and to complete the challenge, we have to "fork all 3 party jars from source and rewrite them so they don't use classes java.beans.*
(possibly replacing them for openbeans) ".
Decision:
Find a lookup for java.beans
that can be changed so it will work on Android. It can be openbeans
or mad-robot
, for example.
Even for the Freemarker pattern, there is a patch that basically changes java.beans
to mad-robot
beans in the source - you can find the fix and the associated thread.
Possible workarounds:
- Applying a patch to support Freemarker Android
- Manually recompile with
openbeans.jar
: code.google.com/p/openbeans/ - Manually recompile with
mad-robot
beans: code.google.com/p/mad-robot/
source to share