cloudinary/cloudinary_android

Got Execption java.lang.NoClassDefFoundError: Failed resolution of: Lcom/evernote/android/job/JobManager; in MediaManager.init(this); statement

kaprat opened this issue · 4 comments

I am getting the below exception in MediaManager.init(this, config); statement.

I am using the libraries cloudinary-core-1.14.0.jar and cloudinary-android-1.20.0.aar

My Code Looks Like

Map config = new HashMap();
config.put("cloud_name", "mycloudname");
config.put("api_key", "myapikey");
config.put("api_secret", "myapisecret");
MediaManager.init(this, config);

03-07 12:17:04.001 9719-9719/com.test.ask E/UncaughtException: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/evernote/android/job/JobManager;
at com.cloudinary.android.AndroidJobStrategy.init(AndroidJobStrategy.java:82)
at com.cloudinary.android.MediaManager.(MediaManager.java:58)
at com.cloudinary.android.MediaManager.init(MediaManager.java:159)
at com.cloudinary.android.MediaManager.init(MediaManager.java:115)
at com.test.ask.AskQuestionActivity.uploadImageToCloudinary(AskQuestionActivity.java:1587)
at com.test.ask.AskQuestionActivity.onClick(AskQuestionActivity.java:1302)
at android.view.View.performClick(View.java:4780)
at android.view.View$PerformClick.run(View.java:19866)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.evernote.android.job.JobManager" on path: DexPathList[[zip file "/data/app/com.test.ask-2/base.apk"],nativeLibraryDirectories=[/data/app/com.test.ask-2/lib/x86, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at com.cloudinary.android.AndroidJobStrategy.init(AndroidJobStrategy.java:82) 
at com.cloudinary.android.MediaManager.(MediaManager.java:58) 
at com.cloudinary.android.MediaManager.init(MediaManager.java:159) 
at com.cloudinary.android.MediaManager.init(MediaManager.java:115) 
at com.test.ask.AskQuestionActivity.uploadImageToCloudinary(AskQuestionActivity.java:1587) 
at com.test.ask.AskQuestionActivity.onClick(AskQuestionActivity.java:1302) 
at android.view.View.performClick(View.java:4780) 
at android.view.View$PerformClick.run(View.java:19866) 
at android.os.Handler.handleCallback(Handler.java:739) 
at android.os.Handler.dispatchMessage(Handler.java:95) 
at android.os.Looper.loop(Looper.java:135) 
at android.app.ActivityThread.main(ActivityThread.java:5254) 
at java.lang.reflect.Method.invoke(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:372) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 
Suppressed: java.lang.ClassNotFoundException: com.evernote.android.job.JobManager
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 17 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

Hi @kaprat,

Could you please share your Gradle dependencies?

Thanks

Hello @yakirp Sir Please check this, I am using Android Studio 3.0.1

Gradle Scripts (Module: app)

apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion '26.0.2'

defaultConfig {
    applicationId "com.test.ask"
    minSdkVersion 16
    targetSdkVersion 26
    versionCode 12
    versionName "1.17"
    multiDexEnabled true
    renderscriptSupportModeEnabled true
}
buildTypes {
    release {
        shrinkResources true
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        //proguardFiles ('proguard-rules.txt'); 'proguard-rules.pro'
    }
}

dexOptions {
    javaMaxHeapSize "2g"
}

useLibrary 'org.apache.http.legacy'

packagingOptions {
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/ECLIPSE_.SF'
    exclude 'META-INF/ECLIPSE_.RSA'
}

}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':ViewPagerIndicator-Library')
compile('org.apache.httpcomponents:httpmime:4.5.2') {
exclude module: 'org.apache.httpcomponents:httpclient'
}
compile project(':audiovideo')
compile files('libs/urlimageviewhelper-1.0.4.jar')
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:support-v4:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.google.android.gms:play-services-places:11.0.4'
compile 'com.google.android.gms:play-services-location:11.0.4'
compile 'com.google.firebase:firebase-messaging:11.0.4'
compile 'com.google.firebase:firebase-crash:11.0.4'
compile 'com.android.volley:volley:1.0.0'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
compile 'io.karim:materialtabs:2.0.5'
compile 'com.balysv:material-ripple:1.0.2'
compile 'com.daimajia.swipelayout:library:1.2.0@aar'
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
compile 'org.apache.httpcomponents:httpcore:4.4.5'
compile 'org.apache.httpcomponents:httpclient:4.5.2'
compile 'com.reginald.swiperefresh:library:1.1.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.koushikdutta.async:androidasync:2.+'
compile 'org.jsoup:jsoup:1.10.3'
compile 'com.instabug.library:instabug:4.3.3'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile project(':photoeditorsdk')
compile 'com.github.esafirm.android-image-picker:imagepicker:1.12.0'
compile 'com.github.bumptech.glide:glide:4.5.0'
compile files('libs/cloudinary-core-1.14.0.jar')
compile project(':cloudinary-android-1.20.0')
}

apply plugin: 'com.google.gms.google-services'

Gradle Scripts(Module: Project)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
classpath 'com.google.gms:google-services:3.0.0'
}
}

allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

Hi,

Could you please change this lines:

compile files('libs/cloudinary-core-1.14.0.jar')
compile project(':cloudinary-android-1.20.0')

To this:
compile group: 'com.cloudinary', name: 'cloudinary-android', version: '1.24.0'

Please let me know if it works for you.

Best,
Yakir

Thank you @yakirp sir it's working now.