简体   繁体   中英

Cannot get the twitter fabric dependencies using gradle

I cannot use the Fabric SDK in android studio. I installed the Fabric plugin, but id does not seem to recognise my project so i intend to do it manually.

buildscript {
    repositories {
        mavenCentral()
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.+'
        // The Fabric Gradle plugin uses an open ended version to react
        // quickly to Android tooling updates
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

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

}

Gradle built successful. but still cannot resolve the symbol Fabric

I add this as a response as I can't add long comments. I have checked the .pom files of the maven repository. The main difference between 2.3.2 and 2.4.0/2.5.0 is that 2.4.0/2.5.0 add some exclusions to the dependency:

<exclusions>
    <exclusion>
      <artifactId>crashlytics-core</artifactId>
      <groupId>com.crashlytics.sdk.android</groupId>
    </exclusion>
    <exclusion>
      <artifactId>crashlytics-ndk</artifactId>
      <groupId>com.crashlytics.sdk.android</groupId>
    </exclusion>
    <exclusion>
      <artifactId>digits</artifactId>
      <groupId>com.digits.sdk.android</groupId>
    </exclusion>
    <exclusion>
      <artifactId>crashlytics</artifactId>
      <groupId>com.crashlytics.sdk.android</groupId>
    </exclusion>
    <exclusion>
      <artifactId>beta</artifactId>
      <groupId>com.crashlytics.sdk.android</groupId>
    </exclusion>
  </exclusions>

You also have to add the dependency to your project:

dependencies {

    // ....

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

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM