Reputation: 383
When i try to instance a new DaoGenerator inside or outside the AsyncTask it crashes my application.
Instancing the DaoGenerator:
Schema schema = new Schema(1,"com.example.administrator.teste");
Entity user = schema.addEntity("User");
user.addIdProperty();
user.addStringProperty("name");
user.addStringProperty("user");
user.addStringProperty("pass");
try {
new DaoGenerator().generateAll(schema, "../db/src");
}catch (Exception e)
{
e.printStackTrace();
}
it gives the following exception:
Caused by: java.lang.VerifyError: freemarker/ext/beans/ClassIntrospector at freemarker.ext.beans.BeansWrapper.(BeansWrapper.java:318) at freemarker.ext.beans.BeansWrapper.(BeansWrapper.java:245) at freemarker.ext.beans.BeansWrapper.(BeansWrapper.java:196) at freemarker.ext.beans.BeansWrapperSingletonHolder.(BeansWrapperSingletonHolder.java:27) at freemarker.ext.beans.BeansWrapper.getDefaultInstance(BeansWrapper.java:795) at freemarker.template.ObjectWrapper.(ObjectWrapper.java:49) at freemarker.template.Configuration.getDefaultObjectWrapper(Configuration.java:1552) at freemarker.core.Configurable.(Configurable.java:151) at freemarker.template.Configuration.(Configuration.java:357) at freemarker.template.Configuration.(Configuration.java:233) at de.greenrobot.daogenerator.DaoGenerator.(DaoGenerator.java:61) at com.example.administrator.teste.LoginActivity$CreateDatase.doInBackground(LoginActivity.java:62) at com.example.administrator.teste.LoginActivity$CreateDatase.doInBackground(LoginActivity.java:48) at android.os.AsyncTask$2.call(AsyncTask.java:288) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:841)
I tried to solve this by compiling in the project freemarker but it gives the same exception.
Additional Info:
Grandle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.administrator.teste"
minSdkVersion 19
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'de.greenrobot:greendao-generator:1.3.1'
compile 'freemarker:freemarker:2.3.9'
compile 'org.freemarker:freemarker:2.3.21'
}
Upvotes: 1
Views: 710
Reputation: 81568
Quote from http://freemarker.org/freemarkerdownload.html :
Until about 2007 the Maven group name was "freemarker" instead of "org.freemarker",
and as the XML comment above says, this can cause problems,
as Maven will see them as two independent artifacts with no version conflict.
If you run into this issue, find the dependency that depends on the old FreeMarker,
and add this to your application's POM where you declare the problematic dependency:
<dependency>
<groupId>...</groupId>
<artifactId>...</artifactId>
<version>...</version>
<exclusions>
<exclusion>
<groupId>freemarker<!-- Do NOT use this org-less group! --></groupId>
<artifactId>freemarker</artifactId>
</exclusion>
</exclusions>
</dependency>
Try this in your dependencies:
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.21</version>
</dependency>
<dependency>
<groupId>de.greenrobot</groupId>
<artifactId>greendao-generator</artifactId>
<version>1.3.1</version>
<exclusions>
<exclusion>
<groupId>freemarker</groupId>
<artifactId>freemarker</artifactId>
</exclusion>
</exclusions>
</dependency>
Or with Gradle:
compile 'org.freemarker:freemarker:2.3.21'
compile('de.greenrobot:greendao-generator:1.3.1') {
exclude module: 'freemarker'
}
Upvotes: 2