1

Completely new to Twitter's Fabric Platform/SDK. I have been trying to integrate it into my existing build.gradle and it's been chaotic so far.

When I try to install the "Log in with Twitter" feature via the Fabric plugin, it updates the build.gradle and then during sync throws the following error:

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

My current android project build.gradle is:

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

}

Somehow Fabric's SDK partially loads, but when I try to import anything com.twitter.sdk.android.Twitter I receive the "Cannot resolve Twitter Symbol" error.

I have:

  • Cleaned and rebuilt the project
  • Invalidated Caches and restarted Android Studio
  • Restarted the computer

Any ideas why it would only partially load? These bulky SDKs with plugins are starting to drive me nuts :-/

Any help / guidance would be appreciated.

5

Replace twitter-core in this line below

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

with twitter so it would look like this

compile('com.twitter.sdk.android:twitter:1.3.2@aar') {
        transitive = true;
    }
  • Thanks. I just updated it to use TwitterAuthConfig(key, secret) instead of Twitter(key, secret). Not sure which is more correct, but it's working now. – markbratanov May 27 '15 at 23:19

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.