Twitter Fabric fails to install in Android Studio due to missing dependencies

后端 未结 4 2105
梦如初夏
梦如初夏 2021-02-14 07:18

I\'m setting up a Cordova project with Fabric to enable signing in with Twitter. I just installed Fabric plug-in into Android Studio but when I sync Gradle files I get the follo

相关标签:
4条回答
  • 2021-02-14 07:31

    Other answers were outdated for me. I fixed the problem by updating build.gradle according to the latest on the github:

    https://github.com/twitter/twitter-kit-android

    0 讨论(0)
  • 2021-02-14 07:33

    It's not enough to install the fabric plugin, you have to use it too. Clicking on the fabric button in Android Studio guides you through the process of including twitter fabric in your app, it even modifies the build.gradle properly for you (with your permission of course). When you follow the steps given, your build.gradle would be looking like what @AlexVPerl's answer says.

    0 讨论(0)
  • 2021-02-14 07:39

    Please follow this code example to make sure your build.gradle file is similar:

        buildscript {
      repositories {
        jcenter()   // <- *add this
        maven { url 'https://maven.fabric.io/repo' }
      }
      dependencies {
        classpath 'com.android.tools.build:gradle:0.13.3'
        // 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'   // <- *make sure this is the same
    
    //Put Fabric plugin after Android plugin
    apply plugin: 'io.fabric'
    
    repositories {
        jcenter()   // <- *add this
        maven { url 'https://maven.fabric.io/repo' }
    }
    

    I had the same issue, spent half a day on this until opened twitters official documentation and came across this: https://dev.twitter.com/twitter-kit/android/integrate

    Too many answers by the Fabric team on SO and other forums that did not work. This works.

    0 讨论(0)
  • 2021-02-14 07:47

    Change jcenter() to mavenCentral() or you can keep both jcenter and mavenCentral also change url from https://maven.fabric.io/repo to https://maven.fabric.io/public

    buildscript {
        repositories {
            mavenCentral()   // <- *add this
            maven { url 'https://maven.fabric.io/public' }
        }
    }
    
    0 讨论(0)
提交回复
热议问题