1

The version of retrofit is 2.0.0 beta2.
It works fine on Android 5.0,but "new Retrofit.Builder() " throws java.lang.NoClassDefFoundError: retrofit.BuiltInConverters on android 4.4.

Logcat:
enter image description here

Build gradle:

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "***"
    minSdkVersion 14
    targetSdkVersion 23
    versionCode 4
    versionName "2.0.3"
    multiDexEnabled true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    debug{
        minifyEnabled false
    }
}
dexOptions {
    javaMaxHeapSize "2g"
}
}
dependencies {
    compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
    compile project(':searchview')
    compile 'com.google.zxing:core:3.2.1'
    compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
    compile 'com.squareup.okhttp:okhttp:2.5.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.android.support:palette-v7:23.1.1'
    compile 'com.android.support:preference-v14:23.1.1'
    compile 'org.jsoup:jsoup:1.8.3'
    compile 'com.commit451:PhotoView:1.2.4'
    compile 'com.google.android.gms:play-services:8.3.0'
    compile 'com.android.support:multidex:1.0.1'
}

Similar to NoClassDefFoundError: retrofit.RestAdapter$Builder When Using retrofit-1.6.1 on Android 4.4
Any help would be appreciated!

---------2015/12/16---------------
I solved it by following this answer:add the multidex support

Community
  • 1
  • 1
wangqi060934
  • 1,552
  • 16
  • 23

0 Answers0