改装版本是2.0.0 beta2 它在Android 5.0上工作正常,但“new Retrofit.Builder()”会在android 4.4上抛出java.lang.NoClassDefFoundError:retrofit.BuiltInConverters。
构建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'
}
与NoClassDefFoundError: retrofit.RestAdapter$Builder When Using retrofit-1.6.1 on Android 4.4类似 任何帮助将不胜感激!
--------- 2015年12月16日---------------
我按照以下答案解决了这个问题:add the multidex support