Error:Failed to resolve: com.twitter.sdk.android:twitter:2.3.0 - Android Studio

前端 未结 7 1805
别跟我提以往
别跟我提以往 2020-12-14 15:46

I am getting this error in my log cat

Error:Failed to resolve: com.twitter.sdk.android:twitter:2.3.0

When I try adding this dependency:

相关标签:
7条回答
  • 2020-12-14 16:19

    Expanding @Hemant Menon answer, and answering @Pheonix's question.

    Add the following line inside "repositories", inside "allprojects" and "buildscript" to your Project Level build.gradle file:

    maven {
        url 'https://maven.fabric.io/public'
    }
    

    So the file will look like:

    buildscript {
        repositories {
            [...]
            maven {
                url 'https://maven.fabric.io/public'
            }
        }
    }
    
    allprojects {
        repositories {
            [...]
            maven {
                url 'https://maven.fabric.io/public'
            }
        }
    }
    
    [...]
    

    Also you'll have to add the following line to your app's Manifest file:

    tools:replace="android:supportsRtl"
    

    So it will look like:

    <?xml version="1.0" encoding="utf-8"?>
    <manifest
        [...]
        xmlns:tools="http://schemas.android.com/tools" >
    
        <application
            [...]
            tools:replace="android:supportsRtl">
            <activity>
                [...]
            </activity>
    
        </application>
    
    </manifest>
    
    0 讨论(0)
  • 2020-12-14 16:23

    In my case, i do both the things i added,

    maven { 
        url 'https://maven.fabric.io/public' 
     }
    

    and

    android:supportsRtl="false"
    

    it works perfectly.

    0 讨论(0)
  • 2020-12-14 16:25

    In Android Manifest file, set android:supportsRtl from "true" to "false"

    android:supportsRtl="false"

    0 讨论(0)
  • 2020-12-14 16:29

    Use this instead. They are the latest versions of each firebaseui components.

    // FirebaseUI for Firebase Realtime Database
    implementation 'com.firebaseui:firebase-ui-database:5.0.0'
    
    // FirebaseUI for Cloud Firestore
    implementation 'com.firebaseui:firebase-ui-firestore:5.0.0'
    
    // FirebaseUI for Firebase Auth
    implementation 'com.firebaseui:firebase-ui-auth:5.0.0'
    
    // FirebaseUI for Cloud Storage
    implementation 'com.firebaseui:firebase-ui-storage:5.0.0'
    
    0 讨论(0)
  • 2020-12-14 16:34

    Let's begin with why - this is from Firebase Authentication docs: "Firebase Authentication provides backend services, easy-to-use SDKs, and ready-made UI libraries to authenticate users to your app. It supports authentication using passwords, popular federated identity providers like Google, Facebook and Twitter, and more."

    So, by using Firebase Authentication we can allow users of our apps to log in with their Google, Facebook, GitHub or - Twitter account.

    Now the help - a bit of detective work reveals, what is happening here. When using something from Git repository - in this case github.com/firebase/FirebaseUI-Android - we should always read the README.md file.

    ...github.com/firebase/FirebaseUI-Android/blob/master/README.md

    Installation...

    dependencies {
        // FirebaseUI Database only
        compile 'com.firebaseui:firebase-ui-database:1.2.0'
    
        // FirebaseUI Auth only
        compile 'com.firebaseui:firebase-ui-auth:1.2.0'
    
        // FirebaseUI Storage only
        compile 'com.firebaseui:firebase-ui-storage:1.2.0'
    
        // Single target that includes all FirebaseUI libraries above
        compile 'com.firebaseui:firebase-ui:1.2.0'
    }
    

    You are using com.firebaseui:firebase-ui:1.1.1, which is older version than in the actual README.md, but this comment still applies:

    // Single target that includes all FirebaseUI libraries above

    So, since it includes all three libraries in one, let's go and read the READMEs for each one of them.

    They can be found on the main page in their folders - database, auth, storage

    https://github.com/firebase/FirebaseUI-Android

    Storage and Database READMEs are about how to use them in Java code, nothing else there.

    But the Auth README.md has something about configuration - and since we are talking about configuration here: https://github.com/firebase/FirebaseUI-Android/tree/master/auth

    Configuration

    As a pre-requisite, ensure your application is configured for use with Firebase: see the Firebase documentation. Then, add the FirebaseUI auth library dependency. If your project uses Gradle, add the dependency:

    dependencies {
        // ...
        compile 'com.firebaseui:firebase-ui-auth:1.2.0'
    }
    

    and add the Fabric repository

    allprojects {
        repositories {
            // ...
            maven { url 'https://maven.fabric.io/public' }
        }
    }
    

    Now, it is not exactly clear, where they want us to put these code snippets, but "dependencies" are in the App level build.gradle file and the "allprojects" section is in the Project level build.gradle file.

    0 讨论(0)
  • 2020-12-14 16:37

    Add this line:

    maven { url 'https://maven.fabric.io/public' }

    inside repositories under both buildscript and allprojects in the build/gradle file.

    0 讨论(0)
提交回复
热议问题