Only on Lollipop: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/squareup/picasso/Picasso;

java lang noclassdeffounderror failed resolution of: lcom/squareup/picasso/okhttpdownloader
java.lang.noclassdeffounderror: failed resolution of: lcom/nineoldandroids/view/viewhelper;

I encounter this problem only on lollipop version. I can run the app easily on versions above lollipop. The error shows up when I run the app in my application file:

   java.lang.NoClassDefFoundError: Failed resolution of: Lcom/squareup/picasso/Picasso;
                                                                 at aroundwise.nepi.MyApplication.onCreate(MyApplication.java:44)
                                                                 at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1020)
                                                                 at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5122)
                                                                 at android.app.ActivityThread.access$1600(ActivityThread.java:177)
                                                                 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1510)
                                                                 at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                 at android.os.Looper.loop(Looper.java:145)
                                                                 at android.app.ActivityThread.main(ActivityThread.java:5951)
                                                                 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:1400)
                                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
                                                              Caused by: java.lang.ClassNotFoundException: Didn't find class "com.squareup.picasso.Picasso" on path: DexPathList[[zip file "/data/app/aroundwise.nepi-2/base.apk"],nativeLibraryDirectories=[/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 aroundwise.nepi.MyApplication.onCreate(MyApplication.java:44) 
                                                                 at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1020) 
                                                                 at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5122) 
                                                                 at android.app.ActivityThread.access$1600(ActivityThread.java:177) 
                                                                 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1510) 
                                                                 at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                 at android.os.Looper.loop(Looper.java:145) 
                                                                 at android.app.ActivityThread.main(ActivityThread.java:5951) 
                                                                 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:1400) 
                                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195) 
                                                                Suppressed: java.lang.ClassNotFoundException: com.squareup.picasso.Picasso
                                                                 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)
                                                                        ... 13 more
                                                              Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

Here is my Application file:

public class MyApplication extends Application {

private static ComplexPreferences sharedPreferences;
public static MyApplication instance;
AroundWiseSDK aroundWiseSDK;
private Picasso picasso;

@Override
public void onCreate() {
    super.onCreate();

    sharedPreferences = ComplexPreferences.getComplexPreferences(getBaseContext(), Constants.PREFFERENCES, MODE_PRIVATE);
    CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
            .setDefaultFontPath("fonts/ProximaNova-Regular.otf")
            .setFontAttrId(R.attr.fontPath)
            .build());

    Callbacks c = new Callbacks();
    instance = this;
    HashMap<String, String> clientData = new HashMap<>();
    clientData.put("key_placeholder", "value_placeholder");

    picasso = Picasso.with(getApplicationContext());
    aroundWiseSDK = new AroundWiseSDK(getBaseContext(), this, c, false, "https://promenada.aroundwise.com", clientData);
    aroundWiseSDK.setMainActivity(DiscoverActivity.class);
    aroundWiseSDK.bindBackgroundService();


}

public Picasso getPicasso() {
    return picasso;
}

@Override
protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
  //  MultiDex.install(base);
}


public static ComplexPreferences getSharedPreferences(Context context) {
    if (sharedPreferences == null) {
        sharedPreferences = ComplexPreferences.getComplexPreferences(context, Constants.PREFFERENCES, MODE_PRIVATE);
    }
    return sharedPreferences;
}

}

This is my gradle:

buildscript {
repositories {
    maven { url 'https://maven.fabric.io/public' }
    jcenter()
}

dependencies {
    // The Fabric Gradle plugin uses an open ended version to react
    // quickly to Android tooling updates
    classpath 'io.fabric.tools:gradle:1.+'
    classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.6.2'
}

}

apply plugin: 'com.android.application'
apply plugin: 'android-apt'
apply plugin: 'io.fabric'
apply plugin: 'com.getkeepsafe.dexcount'


repositories {
    maven { url 'https://maven.fabric.io/public' }
}


android {
    compileSdkVersion 24
buildToolsVersion "25.0.1"

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/BCKEY.DSA'
    exclude 'AUTHORS'
    exclude 'META-INF/services/javax.annotation.processing.Processor' // butterknife
    exclude 'META-INF/BCKEY.SF'
    exclude 'META-INF/maven/com.google.guava/guava/pom.properties'
    exclude 'META-INF/maven/com.google.guava/guava/pom.xml'
}

defaultConfig {
    applicationId "aroundwise.nepi"
    minSdkVersion 21
    targetSdkVersion 24
    versionCode 1
    versionName "1.1.8"
    multiDexEnabled true

}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        //multiDexKeepFile file('multidex-config.txt')
      // multiDexKeepProguard file('multidex-config.pro')

    }

    debug {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
       // multiDexKeepFile file('multidex-config.txt')
  //      multiDexKeepProguard file('multidex-config.pro')

    }
}

applicationVariants.all { variant ->
    variant.outputs.each { output ->
        def apk = output.outputFile;
        def newName;

        if (variant.buildType.name == "release") {
            newName = apk.name.replace("app-debug", "-release-Nepi" + "-v" + defaultConfig.versionName + ".apk");
        } else {
            newName = apk.name.replace("app-debug.apk", "-Nepi" + "-v" + defaultConfig.versionName + ".apk");
        }


        output.outputFile = new File(apk.parentFile, newName);

        if (variant.buildType.zipAlignEnabled) {
            output.outputFile = new File(apk.parentFile, newName.replace("-unaligned", ""));
        }

        logger.info('INFO: Set outputFile to ' + output.outputFile + " for [" + variant.name + "]");
    }
}


}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile('com.crashlytics.sdk.android:crashlytics:2.6.2@aar') {
        transitive = true;
    }

//BUTTERKNIFE
apt 'com.jakewharton:butterknife-compiler:8.2.1'

//MVP & ParcelablePlease & Adapter
apt 'com.hannesdorfmann.annotatedadapter:processor:1.1.1'
apt 'com.hannesdorfmann.parcelableplease:processor:1.0.2'

//AROUNDWISE SDK's
compile(name: 'aroundwisesdk', ext: 'aar')
compile(name: 'aroundwisecards', ext: 'aar')

//GOOGLE

//FACEBOOK

//ANDROID

//RETROFIT&RxANDROID

//UTIL
//compile 'com.lorentzos.swipecards:library:1.0.9@aar'

//BeaconSDk needed
compile 'me.relex:circleindicator:1.1.5@aar'
compile 'com.hannesdorfmann.annotatedadapter:annotation:1.1.1'
compile 'com.hannesdorfmann.annotatedadapter:support-recyclerview:1.1.1'
compile 'com.hannesdorfmann.mosby:mvp:2.0.1'
compile 'com.hannesdorfmann.mosby:viewstate:2.0.1'
compile 'com.hannesdorfmann.parcelableplease:annotation:1.0.2'
compile 'com.hannesdorfmann.mosby:retrofit:1.1.0'
compile 'com.google.gms:google-services:2.1.2'
compile 'com.google.android.gms:play-services-maps:9.4.0'
compile 'com.google.android.gms:play-services-gcm:9.4.0'
compile 'com.google.android.gms:play-services-location:9.4.0'
compile 'com.google.code.gson:gson:2.7'
compile 'com.google.maps.android:android-maps-utils:0.4.4'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:recyclerview-v7:25.0.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:support-annotations:24.2.1'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
compile 'io.reactivex:rxandroid:1.2.0'
compile 'io.reactivex:rxjava:1.1.5'
compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.jakewharton:butterknife:8.2.1'
compile 'com.github.jinatonic.confetti:confetti:1.0.0'
compile 'com.viewpagerindicator:library:2.4.1@aar'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'com.squareup.picasso:picasso:2.5.3-SNAPSHOT'
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
compile 'org.florescu.android.rangeseekbar:rangeseekbar-library:0.3.0'
compile 'com.github.lzyzsd:circleprogress:1.1.0@aar'
compile 'com.daprlabs.aaron:cardstack:0.3.1-beta0'
compile 'org.altbeacon:android-beacon-library:2.+@aar'
compile 'com.squareup.okhttp:okhttp:2.3.0'
provided 'org.glassfish:javax.annotation:10.0-b28'
apt 'com.google.dagger:dagger-compiler:2.0.2'
compile 'com.google.dagger:dagger:2.0.2'
}
repositories {
    flatDir {
        dirs 'libs'
    }

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

}

And this is my manifest. I am using multidex but I do not need to extend MultiDexApplicaiton since I am using minSDK 21 ( at least that is what I understood from the documentation)

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="aroundwise.nepi">

    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.CALL_PHONE" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />


    <permission
        android:name="aroundwise.nepi.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />
    <uses-permission android:name="aroundwise.nepi.permission.C2D_MESSAGE" />

    <uses-feature android:name="android.hardware.camera2" />


    <application
        android:name=".MyApplication"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name=".activities.mainActivity.MainActivity"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="adjustPan">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <meta-data
            android:name="io.fabric.ApiKey"
            android:value="5ef18a8d1003a5ed11bbf50f188bc758133cba38" />

        <activity
            android:name=".activities.onBoardActivity.OnBoardActivity"
            android:screenOrientation="portrait">

        </activity>
        <activity
            android:name=".activities.discoverActivity.DiscoverActivity"
            android:screenOrientation="portrait" />

        <meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value="@string/google_api_key_me" />

        <activity
            android:name=".activities.cameraActivity.CameraActivity"
            android:screenOrientation="portrait" />

        <meta-data
            android:name="com.facebook.sdk.ApplicationId"
            android:value="@string/facebook_app_id" />
        <provider
            android:name="com.facebook.FacebookContentProvider"
            android:authorities="com.facebook.app.FacebookContentProvider840752006058179"
            android:exported="true" />

        <activity
            android:name="com.facebook.FacebookActivity"
            android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
            android:label="@string/app_name"
            android:theme="@android:style/Theme.Translucent.NoTitleBar"
            tools:replace="android:theme" />
        <activity
            android:name="com.facebook.CustomTabActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="@string/fb_login_protocol_scheme" />
            </intent-filter>
        </activity>


        <receiver
            android:name="com.google.android.gms.gcm.GcmReceiver"
            android:exported="true"
            android:permission="com.google.android.c2dm.permission.SEND">
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <category android:name="aroundwise.nepi.gcm" />
            </intent-filter>
        </receiver>

        <service
            android:name=".gcm.PushNotificationListener"
            android:exported="false">
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            </intent-filter>
        </service>

        <service
            android:name=".gcm.GcmIdListenerService"
            android:exported="false">
            <intent-filter>
                <action android:name="com.google.android.gms.iid.InstanceID" />
            </intent-filter>
        </service>
        <service
            android:name=".gcm.GCMRegistationIntentService"
            android:exported="false"></service>

    </application>

</manifest>

I ran out of ideas, so please any help or tips are welcome.

Thank you!

If publishNonDefault true was defined in libs build.gradle, please remove it or make it false. Please try. I have resolved this issue by removing publishNonDefault true in build.gradle of lib which occurred NoClassDefFoundError.

If not working, please add dexOptions { preDexLibraries false }.

Only on Lollipop: java.lang.NoClassDefFoundError: Failed , Only on Lollipop: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/​squareup/picasso/Picasso;. 2017-01-05 11:22 Ionut-Mihai Nicula imported from  That said, this is definitely not a problem with Picasso, but either Android Studio, the Android Gradle plugin, or multidex (or some combination of those). It's hard to know which is causing the problem or what to tell you to change.

If you are using fabric then please remove dependency of picasso from gradle, it will work fine.Try it...

Failed resolution of: Lcom/squareup/picasso/Picasso; · Issue #342 , Conversion to Dalvik format failed: Unable to execute dex: method ID not in [0, compile 'com.squareup.picasso:picasso:2.3.4' java.lang. With Android 5.0 Lollipop release, new support library appeared in It contains only two classes: MultiDex and MultiDexApplication and NoClassDefFoundError . Dismiss Join GitHub today. GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.

You need to install Multidex to run picasso on lower devices

public class MyApplication extends Application {

 @Override
protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
    MultiDex.install(base);
   }
}

add this in your manifest under application tag

android:name="your.package.name.MyApplication"

MultiDex solution for 64k limit in Dalvik. – froger_mcs dev blog , java.lang.NoClassDefFoundError: Failed resolution of: Lcom/samsung/android/​sdk/look/SlookImpl; - android. isSupportedDevice(Slook.java:160) at com.​samsung.android.sdk.look. InflateException only in a signed apk. java.lang.​RuntimeException: Unable to compile 'com.squareup.picasso:picasso:2.5.2' compile  This is not a Picasso problem but one with your build system. The Picasso classes are not being included in your APK. Try a clean build, check ProGuard, use APK analyzer to check for the classes, etc.

java.lang.NoClassDefFoundError: Failed resolution of: Lcom , Java exception in 'NativeModules'java.lang.NoClassDefFoundError: Failed resolution of: can be tested on // Android Lollipop without time consuming dex merging processes. ONLY COPY THINGS FROM EXPOVIEW TO HERE. implementation implementation 'com.squareup.picasso:picasso:2.5.2' implementation  Hello @JakeWharton i have upgraded my project to okhttp3 using compile 'com.squareup.okhttp3:okhttp:3.0.0-RC1',now for image downloading i am using picasso 2.5.2, but for all of the sudden okhttp Downloader is not recognizable by picasso any more, do i need to upgrade picasso library as well in order for it to work with okhttp3,currently i am using gradle build system and do not know much

java, Open issues for picasso. picasso open issues (View Closed Issues) placeholder; about 4 years about cache; about 4 years Fatal Exception: java.lang​. on Samsung Galaxy S4 (4.4.2); almost 5 years why bitmap load crash only above Lollipop image file only; over 3 years NoClassDefFoundError Failed resolution of  the picasso dont work more i dont see any images why? i have try use skipcache and i try to load a color on my imageview before load the new images but dont load =( picass works only 1 time here Shahid Saeed

react native и катапультировался экспо android приложения , Refresh. April 2019. Views. 51 time. 1. I have built an app, it is working fine on iPhone but on Android I have a strange error.

Comments
  • did you find a solution? I'm having same problems
  • I think this helped me : -keep class com.squareup.okhttp.** { ; } -keep interface com.squareup.okhttp.* { ; } -dontwarn com.squareup.okhttp.* Write them in the progruard-rules
  • this saved us big time, thanks for the inspiration: stackoverflow.com/questions/46814593/…
  • Thank you, worked for me too! Worked on Marshmallow and newer but immediately got the crash on Lollipop when setting minSdk = 21.
  • Also had to disable Instant Run when deploying on Lollipop.
  • I have tried, I get Error:(10, 28) error: package com.squareup.picasso does not exist.
  • Then try this: stackoverflow.com/questions/25225327/…
  • Actually it helped, but now I get a second error, almost the same but with :Failed resolution of: Lcom/squareup/okhttp/OkHttpClient;. It crashes when I use the constructor of a class in a library I imported through a aar file : compile(name: 'aroundwisesdk', ext: 'aar'). But now the proguard does not fix the problem :(
  • can you remove multidexEnabled=true ?
  • and if not, then try to put compile 'com.android.support:multidex:1.0.0' // or 1.0.1
  • I do not need lower than 5.0. And what I read on the documentation I only need to specify multiDexEnabled true, don't need to install Multidex. Anyway I tried that way too, but it did not worked. Thanks for the tip