在gradle中添加firebase auth依赖项后,android显示以下错误

时间:2017-11-28 18:39:57

标签: android firebase gradle firebase-authentication firebaseui

Below images shows error after adding firebase auth dependency

在添加fire base auth依赖项之前,它工作正常。在我的build.gradle(app)的代码下面添加了firebase auth依赖项,其中我添加了firebase.auth的依赖项。它显示给定的错误。

apply plugin: 'com.android.application'

repositories {
    mavenLocal()
    flatDir {
        dirs 'libs'
    }
}

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.1"

    defaultConfig {
        applicationId "com.google.firebase.udacity.friendlychat"
        minSdkVersion 16
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE-FIREBASE.txt'
        exclude 'META-INF/NOTICE'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'

    compile 'com.android.support:design:24.2.0'
    compile 'com.android.support:appcompat-v7:24.2.0'

    // Displaying images
    compile 'com.github.bumptech.glide:glide:3.6.1'

    //adding firebase database
    compile 'com.google.firebase:firebase-database:11.6.0'

       // FirebaseUI for Firebase Realtime Database
       compile 'com.firebaseui:firebase-ui-database:3.1.0'

        // FirebaseUI for Cloud Firestore
        compile 'com.firebaseui:firebase-ui-firestore:3.1.0'

       // FirebaseUI for Firebase Auth
       compile 'com.google.firebase:firebase-auth:11.6.0'





}

apply plugin: 'com.google.gms.google-services'

1 个答案:

答案 0 :(得分:0)

这不是Firebase的使用方式。出现在logcat中的Failed to crunch文件意味着Android Studio无法处理该文件。它的路径太长,已达到操作系统的最大文件路径行。

要解决此问题,需要尽可能缩短。它肯定会解决这个错误。我重新命令你有这样的事情:

D:\Resources\Firebase-Weekend\Project

另一种方法是在build.gradle文件(Project)中更改项目的构建目录,如下所示:

allprojects {
    buildDir = "C:/tmp/${rootProject.name}/${project.name}"
    //other lines
}