j256 / ormlite-android

ORMLite Android functionality used in conjunction with ormlite-core
http://ormlite.com/
ISC License
1.59k stars 367 forks source link

java.lang.NoClassDefFoundError: com.j256.ormlite.logger.LoggerFactory #76

Closed ShreyashPromact closed 7 years ago

ShreyashPromact commented 7 years ago

I have included latest library version in my project. All seems working fine. When I try to run project in Lollipop devices, it works fine but when I run the same code or Project in Lower vrsion (e.g. 4.1.2) then it gives me error message as below:

`java.lang.ExceptionInInitializerError
                                                                    at com.ehound.sge.ui.HomeActivity.initDetailsHome(HomeActivity.java:285)
                                                                    at com.ehound.sge.ui.HomeActivity_.onViewChanged(HomeActivity_.java:293)
                                                                    at org.androidannotations.api.view.OnViewChangedNotifier.notifyViewChanged(OnViewChangedNotifier.java:41)
                                                                    at com.ehound.sge.ui.HomeActivity_.setContentView(HomeActivity_.java:58)
                                                                    at com.ehound.sge.ui.HomeActivity_.onCreate(HomeActivity_.java:47)
                                                                    at android.app.Activity.performCreate(Activity.java:5185)
                                                                    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
                                                                    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2071)
                                                                    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2132)
                                                                    at android.app.ActivityThread.access$700(ActivityThread.java:140)
                                                                    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1238)
                                                                    at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                    at android.os.Looper.loop(Looper.java:137)
                                                                    at android.app.ActivityThread.main(ActivityThread.java:4918)
                                                                    at java.lang.reflect.Method.invokeNative(Native Method)
                                                                    at java.lang.reflect.Method.invoke(Method.java:511)
                                                                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994)
                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)
                                                                    at dalvik.system.NativeStart.main(Native Method)
                                                                 Caused by: java.lang.NoClassDefFoundError: com.j256.ormlite.logger.LoggerFactory
                                                                    at com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper.<clinit>(OrmLiteSqliteOpenHelper.java:36)
                                                                    at com.ehound.sge.ui.HomeActivity.initDetailsHome(HomeActivity.java:285) 
                                                                    at com.ehound.sge.ui.HomeActivity_.onViewChanged(HomeActivity_.java:293) 
                                                                    at org.androidannotations.api.view.OnViewChangedNotifier.notifyViewChanged(OnViewChangedNotifier.java:41) 
                                                                    at com.ehound.sge.ui.HomeActivity_.setContentView(HomeActivity_.java:58) 
                                                                    at com.ehound.sge.ui.HomeActivity_.onCreate(HomeActivity_.java:47) 
                                                                    at android.app.Activity.performCreate(Activity.java:5185) 
                                                                    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094) 
                                                                    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2071) 
                                                                    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2132) 
                                                                    at android.app.ActivityThread.access$700(ActivityThread.java:140) 
                                                                    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1238) 
                                                                    at android.os.Handler.dispatchMessage(Handler.java:99) 
                                                                    at android.os.Looper.loop(Looper.java:137) 
                                                                    at android.app.ActivityThread.main(ActivityThread.java:4918) 
                                                                    at java.lang.reflect.Method.invokeNative(Native Method) 
                                                                    at java.lang.reflect.Method.invoke(Method.java:511) 
                                                                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994) 
                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761) 
                                                                    at dalvik.system.NativeStart.main(Native Method) `

I have also try some older library in same project but it is not working and gives me above exception. Can any one help me whats wrong here?

The code was working before when I run it from Eclipse. But after importing it to AndroidStudio, It is not working proper.

Gradle for my project is as below:

`apply plugin: 'com.android.application'
android {
    compileSdkVersion 'Google Inc.:Google APIs:23'
    buildToolsVersion "23.0.2"
    signingConfigs {
        release {
            storeFile file('C:/Users/MyName/.android/key_signed.keystore')
            storePassword 'mypassword'
            keyAlias 'myalias'
            keyPassword 'mypassword'
        }
        debug {
            storeFile file('C:/Users/MyName/.android/key_signed.keystore')
            storePassword 'mypassword'
            keyAlias 'myalias'
            keyPassword 'mypassword'
        }
    }
    defaultConfig {
        applicationId "com.ehound.sge"
        minSdkVersion 15
        targetSdkVersion 23
        multiDexEnabled = true
        signingConfig signingConfigs.debug
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
        exclude 'META-INF/ASL2.0'
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }
}
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:support-v4:23.2.1'
    compile 'com.android.support:design:23.2.1'
    compile files('libs/activation.jar')
    compile files('libs/additionnal.jar')
    compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.6.3'
    compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.6.3'
    compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.6.3'
    compile files('libs/mail.jar')
    compile files('libs/mint-4.0.2.jar')
    compile 'com.google.android.gms:play-services:7.8.0'
    compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
    compile 'com.j256.ormlite:ormlite-android:5.0'
}
`

Need help if anyone have clue to resolved it.

Sincerely, Shreyash

j256 commented 7 years ago

Please take a minute and RTFM. I think you are missing ormite-core. http://ormlite.com/docs/getting-started