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?

4

1 回答 1

8

我刚刚使用以下说明解决了您的问题:

  1. 在你的 build.gradle 里面(一般):

您的构建脚本必须是这样的:

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.你的 build.gradle(app) 必须是这样的:

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

如果您有任何问题,请尝试查看此链接: https ://github.com/twitter/twitter-kit-android

这个对我有用!希望能帮助到你!

于 2015-06-10T09:59:42.730 回答