Twitter-HBC cannot find SchemeRegistryFactory

I am trying to run Twitter HBC on Android with Android Studio.

I am getting the following error:

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)

      

I checked online and it looks like the SchemeRegistry class is deprecated in apache - I'm guessing this is due to the Apache versions compiled as dependencies in my project.

I'm just not sure a) how to fix the problem if this is the problem. b) if this is a real problem.

Here is my gradle build:

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'
}

      

I commented out the guava and apache dependencies - it was an experiment to see if just adding these lines would override any dependencies that Android Studio adds by default. Changed nothing.

+3


source to share





All Articles