Twitter-HBC找不到SchemeRegistryFactory

时间:2015-01-10 10:16:51

标签: android apache gradle android-studio

我正在尝试使用Android Studio在Android上运行Twitter HBC

我收到以下错误:

01-10 02:05:45.151  12662-12662/com.example.lgorse.twitter_test E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.example.lgorse.twitter_test, PID: 12662
    java.lang.NoClassDefFoundError: org.apache.http.impl.conn.SchemeRegistryFactory
            at com.twitter.hbc.ClientBuilder.<init>(ClientBuilder.java:102)
            at com.example.lgorse.twitter_test.MainActivity.onCreate(MainActivity.java:123)
            at android.app.Activity.performCreate(Activity.java:5451)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2359)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2453)
            at android.app.ActivityThread.access$900(ActivityThread.java:173)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5579)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
            at dalvik.system.NativeStart.main(Native Method)

我在线检查过,看起来在apache中不推荐使用SchemeRegistry类 - 我猜这与我的项目中编译为依赖项的Apache版本有关。

我只是不确定a)如果这是问题,如何排除故障b)如果这是实际问题。

这是我的gradle构建:

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}


android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.example.lgorse.twitter_test"
        minSdkVersion 18
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}



dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.3'
    compile('com.twitter.sdk.android:twitter:1.1.1@aar') {
        transitive = true;
    }
    compile 'com.twitter:hbc-core:2.2.0'
    //compile 'com.google.guava:guava:18.0'
   // compile 'org.apache.httpcomponents:httpclient:4.2.5'
}

我评论了guava和apache依赖项 - 这是一个实验,看看简单地添加这些行是否会覆盖Android Studio默认添加的任何依赖项。没有改变任何事情。

0 个答案:

没有答案