apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.abc"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:multidex:1.0.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp:2.0.0'
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
compile 'com.roomorama:caldroid:2.3.1'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
compile 'com.pkmmte.view:circularimageview:1.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.github.justzak:dilatingdotsprogressbar:1.0.1'
}
错误日志报告:
03-21 12:51:46.539 1202-1202/com.abc W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xa61b2908)
03-21 12:51:46.563 1202-1202/com.abc E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.ExceptionInInitializerError
at com.abc.LoginActivity.userLogin(LoginActivity.java:138)
at com.abc.LoginActivity$2.onClick(LoginActivity.java:128)
at android.view.View.performClick(View.java:4204)
at android.view.View$PerformClick.run(View.java:17355)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
atcom.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoClassDefFoundError: com.squareup.okhttp.OkHttpClient
at com.abc.retrofit.RestClient.setupRestClient(RestClient.java:36)
at com.abc.retrofit.RestClient.<clinit>(RestClient.java:17)
com.abc.LoginActivity.userLogin(LoginActivity.java:138)
com.abc.LoginActivity$2.onClick(LoginActivity.java:128)
at android.view.View.performClick(View.java:4204)
at android.view.View$PerformClick.run(View.java:17355)
android.os.Handler.handleCallback(Handler.java:725)
android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
atcom.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
答案 0 :(得分:0)
将compile 'com.squareup.okhttp:okhttp:2.5.0'
添加到依赖项:
dependencies {
...
compile 'com.squareup.okhttp:okhttp:2.5.0'
}