使用 Fabric 找不到符号导入 com.twitter.sdk.android.Twitter

Cannot find symbol import com.twitter.sdk.android.Twitter using Fabric

Twitter 的 Fabric 全新 Platform/SDK。我一直在尝试将它整合到我现有的 build.gradle 中,但到目前为止一直很混乱。

当我尝试通过 Fabric 插件安装 "Log in with Twitter" 功能时,它会更新 build.gradle 然后在同步期间抛出以下错误:

Note: Resolve log file to C:\Users\Mark\AndroidStudioProjects\StarkEnglish2\app\build\generated\source\apt\androidannotations.log
Note: Initialize AndroidAnnotations 3.3.1 with options {androidManifestFile=C:\Users\Mark\AndroidStudioProjects\StarkEnglish2\app\build\intermediates\manifests\full\debug\AndroidManifest.xml}
C:\Users\Mark\AndroidStudioProjects\StarkEnglish2\app\src\main\java\com\starkenglish\app\StarkApplication.java:5: error: cannot find symbol
import com.twitter.sdk.android.Twitter;
                              ^
  symbol:   class Twitter
  location: package com.twitter.sdk.android
warning: The following options were not recognized by any processor: '[androidManifestFile]'
1 error

 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

我当前的 android 项目 build.gradle 是:

apply plugin: 'com.android.application'


buildscript {
    repositories {
        mavenCentral()

        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        // replace with the current version of the Android plugin
        classpath 'com.android.tools.build:gradle:1.2.3'

        classpath 'io.fabric.tools:gradle:1.+'

        // replace with the current version of the android-apt plugin
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'



    }
}


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


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


def AAVersion = '3.3.1'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/LICENSE-FIREBASE.txt'
    }
    defaultConfig {
        applicationId "..."
        minSdkVersion 19
        targetSdkVersion 21
        versionCode 2
        versionName '1.0.1'
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

        }
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile('com.twitter.sdk.android:twitter-core:1.3.2@aar') {
        transitive = true;
    }
    compile 'com.firebase:firebase-client-android:2.0.3'
    compile 'com.android.support:appcompat-v7:22.1.1'
    compile 'com.google.android.gms:play-services:7.3.0'
    apt "org.androidannotations:androidannotations:$AAVersion"
    compile "org.androidannotations:androidannotations-api:$AAVersion"
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.daimajia.easing:library:1.0.1@aar'
    compile 'com.daimajia.androidanimations:library:1.1.3@aar'
    //compile 'com.facebook.android:facebook-android-sdk:4.1.0'
    compile 'com.github.gabrielemariotti.cards:cardslib-core:2.1.0'
    compile 'com.github.gabrielemariotti.cards:cardslib-cards:2.1.0'
    compile 'com.github.gabrielemariotti.cards:cardslib-recyclerview:2.1.0'
}


apt {
    arguments {
        androidManifestFile variant.outputs[0].processResources.manifestFile
        // if you have multiple outputs (when using splits), you may want to have other index than 0

        // You can set optional annotation processing options here, like these commented options:
        // logLevel 'INFO'
        // logFile '/var/log/aa.log'
    }

}

Fabric 的 SDK 以某种方式部分加载,但当我尝试导入任何内容时 com.twitter.sdk.android.Twitter 我收到 "Cannot resolve Twitter Symbol" 错误。

我有:

知道为什么它只能部分加载吗?这些带有插件的笨重 SDK 开始让我抓狂:-/

如有任何帮助/指导,我们将不胜感激。

替换下面这一行中的 twitter-core

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

用推特 所以它看起来像这样

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