2

I'm trying to integrate twitter login in my application, however not able to succeed yet.

https://dev.twitter.com/twitter-kit/android/twitter-login

In the above link it asks us to install Twitter Core library

dependencies {
    compile('com.twitter.sdk.android:twitter-core:1.3.1@aar') {
        transitive = true;
    }
}

However, this library isn't being downloaded. I always throws an error

Failed to resolve: com.twitter.sdk.android:twitter-core:1.3.1

What should i do?

Vivek Malhotra
  • 751
  • 2
  • 7
  • 17

1 Answers1

8

I have just solved your problem using the next instructions:

  1. Inside your build.gradle (general):

your build script must be like this:

buildscript {
    repositories {
        mavenCentral()
        maven { url 'https://maven.fabric.io/public' }
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

2.Your build.gradle (app) must be like this:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "22.0.1"

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

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


dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.1.1'
    compile('com.twitter.sdk.android:twitter:1.5.1@aar') {
        transitive = true
    }
}

If you have any question, try to take a look this link: https://github.com/twitter/twitter-kit-android

It works for me! Hope it helps!

  • 1
    Thanks. That does solve the problem. However, there is also an automated way to get this done by Automated Fabric Twitter integration using Android Studio/IntelliJ plugins. That's the easiest method. https://fabric.io/downloads – Vivek Malhotra Jun 10 '15 at 10:18