0

我正在开发 android 应用程序。我正在使用 twitter 数字进行身份验证。在 twitter 数字应用程序的帮助下,应用程序正在运行,但每当我使用 Retrofit 时,应用程序就会崩溃。

下面是我的日志猫:

FATAL EXCEPTION: main
                                                                          Process: com.shikshabharti.edumedia24, PID: 500
                                                                          java.lang.NoClassDefFoundError: Failed resolution of: Lretrofit/RestAdapter$Builder;
                                                                              at com.twitter.sdk.android.core.internal.oauth.OAuthService.<init>(OAuthService.java:51)
                                                                              at com.twitter.sdk.android.core.internal.oauth.OAuth2Service.<init>(OAuth2Service.java:60)
                                                                              at com.digits.sdk.android.DigitsGuestSessionProvider.<init>(DigitsGuestSessionProvider.java:38)
                                                                              at com.digits.sdk.android.DigitsClient.createAuthRequestQueue(DigitsClient.java:98)
                                                                              at com.digits.sdk.android.DigitsClient.<init>(DigitsClient.java:86)
                                                                              at com.digits.sdk.android.DigitsClient.<init>(DigitsClient.java:58)
                                                                              at com.digits.sdk.android.Digits.createDigitsClient(Digits.java:251)
                                                                              at com.digits.sdk.android.Digits.getDigitsClient(Digits.java:240)
                                                                              at com.digits.sdk.android.Digits.authenticate(Digits.java:147)
                                                                              at com.digits.sdk.android.Digits.authenticate(Digits.java:101)
                                                                              at com.shikshabharti.edumedia24.activities.RegistrationActivity.onCreate(RegistrationActivity.java:77)
                                                                              at android.app.Activity.performCreate(Activity.java:5966)
                                                                              at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
                                                                              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2408)
                                                                              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2517)
                                                                              at android.app.ActivityThread.access$800(ActivityThread.java:162)
                                                                              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1412)
                                                                              at android.os.Handler.dispatchMessage(Handler.java:106)
                                                                              at android.os.Looper.loop(Looper.java:189)
                                                                              at android.app.ActivityThread.main(ActivityThread.java:5530)
                                                                              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:950)
                                                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745)
                                                                           Caused by: java.lang.ClassNotFoundException: Didn't find class "retrofit.RestAdapter$Builder" on path: DexPathList[[zip file "/data/app/com.shikshabharti.edumedia24-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 com.twitter.sdk.android.core.internal.oauth.OAuthService.<init>(OAuthService.java:51) 
                                                                              at com.twitter.sdk.android.core.internal.oauth.OAuth2Service.<init>(OAuth2Service.java:60) 
                                                                              at com.digits.sdk.android.DigitsGuestSessionProvider.<init>(DigitsGuestSessionProvider.java:38) 
                                                                              at com.digits.sdk.android.DigitsClient.createAuthRequestQueue(DigitsClient.java:98) 
                                                                              at com.digits.sdk.android.DigitsClient.<init>(DigitsClient.java:86) 
                                                                              at com.digits.sdk.android.DigitsClient.<init>(DigitsClient.java:58) 
                                                                              at com.digits.sdk.android.Digits.createDigitsClient(Digits.java:251) 
                                                                              at com.digits.sdk.android.Digits.getDigitsClient(Digits.java:240) 
                                                                              at com.digits.sdk.android.Digits.authenticate(Digits.java:147) 
                                                                              at com.digits.sdk.android.Digits.authenticate(Digits.java:101) 
                                                                              at com.shikshabharti.edumedia24.activities.RegistrationActivity.onCreate(RegistrationActivity.java:77) 
                                                                              at android.app.Activity.performCreate(Activity.java:5966) 
                                                                              at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) 
                                                                              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2408) 
                                                                              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2517) 
                                                                              at android.app.ActivityThread.access$800(ActivityThread.java:162) 
                                                                              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1412) 
                                                                              at android.os.Handler.dispatchMessage(Handler.java:106) 
                                                                              at android.os.Looper.loop(Looper.java:189) 
                                                                              at android.app.ActivityThread.main(ActivityThread.java:5530) 
                                                                              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:950) 
                                                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745) 
                                                                            Suppressed: java.lang.ClassNotFoundException: retrofit.RestAdapter$Builder
                                                                              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)
                                                                                    ... 25 more
                                                                           Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

这是我的编译依赖

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.2.0'
    compile 'com.android.support:design:23.2.0'
    compile 'com.android.support:cardview-v7:23.2.0'
    compile 'com.android.support:recyclerview-v7:23.2.0'
    compile 'com.google.android.gms:play-services-gcm:8.4.0'
    compile 'com.squareup.okhttp:okhttp:2.7.3'
    compile 'com.squareup.okhttp:okhttp-urlconnection:2.7.3'
    compile 'com.squareup.retrofit2:retrofit:2.0.2'
    compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
    compile('com.digits.sdk.android:digits:1.10.3@aar') {
        transitive = true;
    }

在添加改造依赖应用程序崩溃之前,请为我提供解决方案。

4

2 回答 2

1

您没有使用相同的版本进行改造及其转换器。试试这个版本:

compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'com.squareup.okhttp3:logging-interceptor:3.2.0'
compile 'com.google.code.gson:gson:2.6.2'
于 2016-06-14T12:35:16.500 回答
1

我遇到了这个错误,这是因为 digit 。数字是使用改造 1.x 版本。

于 2016-06-23T07:18:32.633 回答