无法解决:com.twitter.sdk.android:twitter:1.12.1

时间:2016-02-15 13:14:46

标签: android twitter

我想整合Twitter sdk分享,我正在使用compileSdkVersion 22buildToolsVersion '22.0.1',遵循fabric site上给出的所有步骤,但收到的错误{{1}同步

  

错误:(25,13)无法解决:   com.twitter.sdk.android:twitter:1.12.1

3 个答案:

答案 0 :(得分:2)

您可以使用

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

浏览 Twitter

答案 1 :(得分:1)

我对内部build.gradle文件进行了以下更改

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

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
repositories {
    mavenCentral()
    maven { url 'https://maven.fabric.io/public' }
}

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'



dependencies {
    compile fileTree(include: '*.jar', dir: 'libs')
    compile project(':google-play-services_lib')

    compile 'com.android.support:multidex:1.0.0'

    compile ('com.facebook.android:facebook-android-sdk:4.0.0'){
        exclude module: 'bolts-android'
        exclude module: 'support-v4'
    }
    compile('com.twitter.sdk.android:twitter:1.12.1@aar') {
        transitive = true;
        exclude module: 'support-v4'
    }


}

android {
    compileSdkVersion 22
    buildToolsVersion '22.0.1'

    defaultConfig {
        applicationId "com.package.name"
        minSdkVersion 14
        targetSdkVersion 22
        versionCode 13
        versionName "1.0"
        multiDexEnabled true
    }


    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        // Move the tests to tests/java, tests/res, etc...
        instrumentTest.setRoot('tests')

        // Move the build types to build-types/<type>
        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
        // This moves them out of them default location under src/<type>/... which would
        // conflict with src/ being used by the main source set.
        // Adding new build types or product flavors should be accompanied
        // by a similar customization.
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }


}

并对外部build.gradle文件进行了以下更改

 // Top-level build file where you can add configuration options common to  all sub-projects/modules.

    buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'

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

allprojects {
    repositories {
        jcenter()
    }
}

它运行良好。

答案 2 :(得分:1)

这是将来参考的解决方案。 在顶层模块级build.gradle

添加以下代码行
buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'io.fabric'
//apply plugin: 'realm-android'
repositories {
    maven { url 'https://maven.fabric.io/public' }
}

在模块的主目录中添加google-services.json文件。

这是如何将twitter登录与firebase身份验证集成的参考站点 https://firebase.google.com/docs/auth/android/twitter-login