Question

I just downloaded the new jar file for GreenDao in order to create my DB for the app I'm building.

After going through all the process of modeling my entities and the connections between them, I tried to run the generator project but got this error for the line that generated the DB:

Exception in thread "main" java.lang.NoClassDefFoundError: freemarker/template/ObjectWrapper
    at com.glide.talk.glide.model.generator.Model.main(Model.java:29)
Caused by: java.lang.ClassNotFoundException: freemarker.template.ObjectWrapper
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    ... 1 more

The line this happened in is: new DaoGenerator().generateAll(schema, src); and I have in the buildpath and in the lib folder only the greendao-generator-1.3.0.jar file.

Any thoughts or solutions will be very helpful.

p.s. is it ok to use the freemaker.jar that was in version 1.2?

EDIT: for now, I downloaded this version from sourceforge and am hoping this is actually what I need to use.

Was it helpful?

Solution

I had a similar problem and downloaded the jar from http://mvnrepository.com/artifact/org.freemarker/freemarker which worked out well.

When you take a look at build.gradle in the DaoGenerator-project, you'll find a dependency that points exactly to this artifact. I guess using gradle to build your project automatically downloads these dependencies just like maven does. If you do not wish to use either, it's probably fine to download and include the artifacts manually.

OTHER TIPS

I had the same error but i was trying to compile the greendao-generator at my main project, but you must create a java module for greenDao then it will not ask for the freemarker.

use greendao-generator inside the java module and greendao inside main project

you may follow this tutorial GreenDao and Android Studio tutorial

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top