android intellij项目中的OrmLiteConfigUtil NoClassDefFoundError

时间:2014-06-29 12:35:04

标签: android intellij-idea ormlite

运行OrmLiteConfigUtil以创建表配置文本文件时,虽然已将libs正确添加到项目依赖项中,但仍会抛出com / j256 / ormlite / android / apptools / OrmLiteConfigUtil的NoClassDefFoundError。

Libs有一个“提供”范围,包含ormlite-core和ormlite-android。

1 个答案:

答案 0 :(得分:1)

解决了!
libs实际上需要" Compiled"在Intellij下运行OrmLiteConfigUtil的范围 如果他们是"提供",这根本不起作用!

Stacktrace给出了:

    Exception in thread "main" java.lang.NoClassDefFoundError: com/j256/ormlite/android/apptools/OrmLiteConfigUtil
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$100(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:116)
    Caused by: java.lang.ClassNotFoundException: com.j256.ormlite.android.apptools.OrmLiteConfigUtil
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 15 more

    Process finished with exit code 1