Android Twitter和Fabric Integration

时间:2017-03-11 21:36:28

标签: android gradle twitter crashlytics twitter-fabric

我试图为我的Android应用程序(也是崩溃剂)实施twitter登录。但是我的gradle有问题;有趣的是我之前为另一个应用做了这个。这是我的应用级Gradle:

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

    dependencies {
        // These docs use an open ended version so that our plugin
        // can be updated quickly in response to Android tooling updates

        // We recommend changing it to the latest version from our changelog:
        // https://docs.fabric.io/android/changelog.html#fabric-gradle-plugin
        classpath 'io.fabric.tools:gradle:1.+'
    }
}

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

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

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.0"
    defaultConfig {
        applicationId "com.stuff.stuffapp"
        minSdkVersion 19
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile('io.socket:socket.io-client:0.8.3') {
        exclude group: 'org.json', module: 'json'
    }
    compile 'com.android.support:recyclerview-v7:25.1.1'
    compile 'com.android.support:appcompat-v7:25.1.1'
    compile 'com.android.support:design:25.1.1'
    compile 'com.squareup.retrofit2:retrofit:2.1.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.jakewharton:butterknife:8.4.0'
    compile 'com.google.code.gson:gson:2.8.0'
    compile 'com.squareup.retrofit2:converter-gson:2.0.2'
    compile 'org.greenrobot:eventbus:3.0.0'
    compile 'com.android.support:support-v4:25.1.1'
    compile 'com.android.support:cardview-v7:25.1.1'
    compile 'com.iainconnor:objectcache:0.0.19-SNAPSHOT'
    compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
    compile 'com.google.firebase:firebase-messaging:10.0.1'
    testCompile 'junit:junit:4.12'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
    compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
    compile 'com.squareup.okhttp3:okhttp:3.4.1'
    compile 'com.facebook.android:facebook-android-sdk:[4,5)'
    compile('com.twitter.sdk.android:twitter-core:2.3.2@aar') {
        transitive = true;
    }
    compile('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') {
        transitive = true;
    }
}

apply plugin: 'com.google.gms.google-services'

我收到了错误:

无法解决:com.twitter.sdk.android:twitter-core:2.3.2

无法解决:annotationProcessor

此外,当我更改为Twitter 2.3.0时,找不到我的Twitter对象

1 个答案:

答案 0 :(得分:2)

使用twitter而不是twitter-core:

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

我测试了它,并且使用了注释处理器。