2
The Okhttp 2.6.0 library does not work in versions prior to Android 5. In versions prior to Lollipop always fires the exception:
Exception
Caused by: java.lang.Noclassdeffounderror: com.squareup.okhttp.internal.Util at com.squareup.okhttp.OkHttpClient. (Okhttpclient.java:58)
My build.Radle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
minSdkVersion 9
targetSdkVersion 23
versionCode 14
versionName '1.6.7'
multiDexEnabled true
}
signingConfigs {
release {}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
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/ASL2.0'
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':number_picker_lib_2')
compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'
compile 'org.codehaus.jackson:jackson-core-asl:1.9.13'
compile 'com.squareup.okhttp:okhttp:2.6.0'
compile 'com.github.machinarius:preferencefragment:0.1.1'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.google.android.gms:play-services-ads:8.3.0'
compile 'com.google.android.gms:play-services-identity:8.3.0'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
compile 'com.jakewharton:butterknife:6.1.0'
compile 'de.hdodenhof:circleimageview:1.3.0'
}
I’m using the same version as you! And I haven’t had any problems so far! The lowest version we tested here is 4.0.3. According to the documentation: Okhttp Supports Android 2.3 and above. For Java, the minimum requirement is 1.7.
– Thiago Luiz Domacoski
This is the weirdest because I have another app that works well too. Suddenly stopped working. It seems to me that it was after the update of Android Studio and Build Tools.
– Luídne
I had a problem with appcompat-v7. I climbed the version and it could not find... To solve, I removed Android Studio, downloaded again and reinstalled! Then I’m cool!
– Thiago Luiz Domacoski