Greendao使用java.lang.NoClassDefFoundError构建失败的应用程序崩溃

时间:2016-03-06 16:27:10

标签: android greendao retrofit2 android-multidex

我在这个项目中使用greenDAO。构建项目gradle构建失败时,在消息日志中显示以下错误

:app:dexDebug
warning: Ignoring InnerClasses attribute for an anonymous inner class
(freemarker.cache.FileTemplateLoader$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The     recommended
solution is to recompile the class from source, using an up-to-date     compiler
and without specifying any "-target" type options. The consequence of     ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(freemarker.cache.FileTemplateLoader$2) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced     by a
compiler that did not target the modern .class file format. The     recommended
solution is to recompile the class from source, using an up-to-date     compiler
and without specifying any "-target" type options. The consequence of     ignoring
this warning is that reflective operations on this class will     incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(freemarker.cache.FileTemplateLoader$3) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The         recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(freemarker.cache.FileTemplateLoader$4) that doesn't come with an
associated EnclosingMethod attribute.     ...........................................

在评论行

时成功完成gradle构建
// compile 'org.freemarker:freemarker:2.3.23'

但是应用程序崩溃了登录三星kitkat平板电脑,但应用程序没有崩溃,并在棒棒糖设备中运行良好。可能的解决方案和背后的区域

03-07 10:05:56.756 25637-25637/com.view9.stoddart E/AndroidRuntime:   FATAL EXCEPTION: main
                                                                  Process: com.view9.stoddart, PID: 25637
                                                                java.lang.NoClassDefFoundError: stoddartdb.RiskassessmentidtableDao
                                                                    at stoddartdb.DaoMaster.createAllTables(DaoMaster.java:23)
                                                                    at stoddartdb.DaoMaster$OpenHelper.onCreate(DaoMaster.java:42)
                                                                    at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:252)
                                                                    at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164)
                                                                    at com.view9.stoddart.utills.AppController.setUpDatabase(AppController.java:72)
                                                                    at com.view9.stoddart.utills.AppController.onCreate(AppController.java:67)
                                                                    at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)
                                                                    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4615)
                                                                    at android.app.ActivityThread.access$1600(ActivityThread.java:169)
                                                                    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1340)
                                                                    at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                    at android.os.Looper.loop(Looper.java:146)
                                                                    at android.app.ActivityThread.main(ActivityThread.java:5487)
                                                                    at java.lang.reflect.Method.invokeNative(Native Method)
                                                                    at java.lang.reflect.Method.invoke(Method.java:515)
                                                                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
                                                                    at dalvik.system.NativeStart.main(Native Method)    

的build.gradle

apply plugin: 'com.android.application'
android {
 compileSdkVersion 23
 buildToolsVersion "23.0.2"
defaultConfig {
    applicationId "com.view9.stoddart"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

sourceSets {
    main {
        manifest.srcFile 'src/main/AndroidManifest.xml'
        java.srcDirs = ['src/main/java', 'src/main/java-gen']
        res.srcDirs = ['src/main/res']
    }
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'org.freemarker:freemarker:2.3.23'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.rengwuxian.materialedittext:library:2.0.3'
 //  compile 'com.mcxiaoke.volley:library-aar:1.0.0'
   compile group: 'cz.msebera.android', name: 'httpclient', version:        '4.4.1.1'
compile 'com.github.flavienlaurent.datetimepicker:library:0.0.2'
     compile 'com.pnikosis:materialish-progress:1.5'
    compile 'de.greenrobot:greendao:1.3.7'
compile 'com.google.maps.android:android-maps-utils:0.4'

// Retrofit & OkHttp
compile 'com.squareup.retrofit2:retrofit:2.0.0-beta4'
compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4'
compile 'com.squareup.okhttp3:logging-interceptor:3.0.1'
compile 'com.squareup.retrofit2:converter-scalars:2.0.0-beta4'
compile ('com.squareup.retrofit2:converter-simplexml:2.0.0-beta4' ){
    exclude group: 'xpp3', module: 'xpp3'
    exclude group: 'stax', module: 'stax-api'
    exclude group: 'stax', module: 'stax'
}

compile project(':DragListviewLib')
compile project(':PhotoPicker')

}

0 个答案:

没有答案