I am trying to use freemarker library into my project but I am getting error while initializing Configuration object.
I further investigated the the issue and I foun
Problem:
Although Freemarker officially does not support Android, it published special *.jars for GAE to provide some support, and a lot of other Android solutions could successfully use Freemarker in their application (either rendering view/code, or just to evaluate some expressions).
Cause:
The root cause of the issue is that Freemarker would use a few things from java.beans
package which is for some reason not included in Android core libraries.
According to a reply on Stackoverflow (/questions/15065545/using-jars-that-use-java-beans-classes-introspector-beaninfo-or-propertydescri), this is a disadvantage of Android, and to accomplish the task, we should “fork all 3th party jars from source and rewrite them so they don't use java.beans.*
classes (possibly by replacing them for openbeans).”
Solution:
Find a substitution for java.beans
, which can be changed, so it would work on Android. It can be openbeans
, or mad-robot
for example.
Even there is a patch existing for Freemarker, which is basically changing java.beans
to mad-robot
beans in its source code - you can find the patch and the related thread here.
Possible workarounds:
openbeans.jar
: code.google.com/p/openbeans/mad-robot
beans: code.google.com/p/mad-robot/