更新classpath 3.0.0后GreenDao无法正常工作

时间:2017-11-09 05:48:11

标签: android build.gradle greendao

昨天我更新了我的Android Studio。更新后,如果我运行GreenDao应用程序,我收到错误。

    Exception in thread "main" java.lang.NoClassDefFoundError: org/greenrobot/greendao/generator/Schema
    at com.example.ApplicationDaoGenerator.main(ApplicationDaoGenerator.java:11)
Caused by: java.lang.ClassNotFoundException: org.greenrobot.greendao.generator.Schema
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 1 more

Process finished with exit code 1

我尝试使用this解决方案。但没有运气。我还尝试使用this链接。这对我也没有帮助。请让我解决这个问题。

我正在使用compile 'org.greenrobot:greendao-generator:3.2.2'

我的应用程序生成器:

public static void main(String[] args) {
        Schema schema = new Schema(1, "com.bla.bla.dao"); 
        schema.enableKeepSectionsByDefault();    
        createTables(schema);

        try {
            new DaoGenerator().generateAll(schema,"./app/src/main/java");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

我也试过以下。但没有运气

apply plugin: 'java'
apply plugin: 'application'
mainClassName = "com.example.ApplicationDaoGenerator"


dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'org.greenrobot:greendao-generator:3.2.0'
}

sourceCompatibility = "1.7"
targetCompatibility = "1.7"

0 个答案:

没有答案