簡體   English   中英

使用Fabric無法找到符號導入com.twitter.sdk.android.Twitter

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

完全不屬於Twitter的Fabric平台/ SDK。 我一直試圖將其集成到我現有的build.gradle ,到目前為止一直很混亂。

當我嘗試通過Fabric插件安裝“使用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我收到“無法解析Twitter符號”錯誤。

我有:

  • 清理並重建項目
  • 無效的緩存並重新啟動了Android Studio
  • 重新啟動電腦

任何想法為什么它只會部分加載? 這些帶有插件的笨重的SDK開始讓我發瘋:-/

任何幫助/指導將不勝感激。

在下面的這一行中替換twitter-core

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

與Twitter,所以它看起來像這樣

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM