使用高于15.0.0版本的FireStore会导致错误 [英] Using FireStore later than 15.0.0 version is causing an error

查看:78
本文介绍了使用高于15.0.0版本的FireStore会导致错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用大于15.0.0的'com.google.firebase:firebase-firestore:'构建我的应用程序时,会出现运行任务"错误:

When I build my app with 'com.google.firebase:firebase-firestore:' more than 15.0.0 it gives a Run tasks error:

Program type already present: com.google.protobuf.AbstractMessageLite$Builder$LimitedInputStream

我已经搜索了这个问题,发现唯一的解决方案是使用15.0.0代替FireStore的17.0.4版本,是否还有其他方法可以在我的项目中使用最新版本?

I have searched about this problem and found the only solution is to use 15.0.0 instead of 17.0.4 version of FireStore is there is any other way to use the latest versions in my project?

成绩构建扫描链接:使用15.0.0时

Grade build scan links: when using 15.0.0, when using 17.0.4

这是IDE找到的3 LimitedInputStream.class

Here is the 3 LimitedInputStream.class that IDE found

我看到其中一个是700多行,所以如果您需要查看它们,可以将它们上传到任何网站.

I saw one of them is 700+ line so if you need to look at them I can upload them to any website.

具有FireSotre实现的后端的等级:

Gradle of the backend that has the FireSotre implementation:

apply plugin: 'com.android.library'

android {
    compileSdkVersion 27
    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner         "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')

// modules
implementation project(path: ':shared.resources')

// ui
implementation "com.mikepenz:iconics-core:${versions.iconicsLib}"
implementation "com.mikepenz:iconics-views:${versions.iconicsLib}"
implementation 'com.mikepenz:ionicons-typeface:2.0.1.4@aar'
implementation 'com.unstoppable:submitbutton:1.1.3'
implementation('com.lamudi.phonefield:phone-field:0.1.3@aar') {
    transitive = true
}
implementation 'com.infideap.blockedittext:block-edittext:0.0.6'
implementation 'com.firebaseui:firebase-ui-auth:4.0.0'

// support
implementation "com.android.support:appcompat-v7:${versions.supportLib}"
implementation 'com.android.support.constraint:constraint-layout:1.1.2'

// firebase
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.2'
implementation 'com.google.firebase:firebase-firestore:17.0.4'

// social media
implementation 'com.facebook.android:facebook-android-sdk:4.34.0'
implementation 'com.twitter.sdk.android:twitter-core:3.3.0@aar'

// mixed versions avoidance
implementation "com.android.support:support-media-compat:${versions.supportLib}"
implementation "com.android.support:support-v4:${versions.supportLib}"

// timber
implementation "com.jakewharton.timber:timber:${versions.timberLib}"

// testing
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
apply plugin: 'com.google.gms.google-services'

顶级Gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext{
    versions = [
            supportLib: "27.1.1",
            archLib: "1.1.1",
            butterKnifeLib: '8.8.1',
            constraintLayuotLib: '1.1.2',
            junitLib: '4.12',
            testRunnerLib: '1.0.2',
            iconicsLib: '3.0.4@aar',
            timberLib: '4.7.1'
    ]
}

repositories {
    google()
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.1.3'
    classpath 'com.google.gms:google-services:4.0.2'
}
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
        maven{ url "https://dl.bintray.com/infideap2/Block-EditText" }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

App Gradle

App Gradle

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
defaultConfig {
    applicationId "com.tech.futureteric.goodmorning"
    // TODO support com.firebaseui:firebase-ui-auth on api 15
    minSdkVersion 16
    targetSdkVersion 27
    versionCode 1
    versionName "1.0-alpha"
    multiDexEnabled true
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    buildTypes.each {
        it.buildConfigField "String", "UNSPLASH_API_KEY", "\"$System.env.UNSPLASH_API_KEY\""
    }
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')

// modules
implementation project(path: ':lockscreen.ui')
implementation project(path: ':intro.ui')
implementation project(path: ':shared.resources')
implementation project(path: ':backend')
implementation project(path: ':find.friends')

// lockScreen ui libraries
implementation 'com.github.HITGIF:TextFieldBoxes:1.4.4'

// about ui libraries
implementation "com.mikepenz:aboutlibraries:6.1.0"
implementation 'com.github.jrvansuita:MaterialAbout:0.2.3'

// timber
implementation "com.jakewharton.timber:timber:${versions.timberLib}"

// lifecycle and persistence
implementation "android.arch.lifecycle:extensions:${versions.archLib}"
implementation "android.arch.lifecycle:viewmodel:${versions.archLib}"
implementation "android.arch.persistence.room:runtime:${versions.archLib}"
annotationProcessor "android.arch.persistence.room:compiler:${versions.archLib}"

// injection
implementation 'javax.inject:javax.inject:1@jar'

// butterKnife
implementation "com.jakewharton:butterknife:${versions.butterKnifeLib}"
annotationProcessor "com.jakewharton:butterknife-compiler:${versions.butterKnifeLib}"

// retrofit
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'

// support libraries
implementation "com.android.support:appcompat-v7:${versions.supportLib}"
implementation "com.android.support:design:${versions.supportLib}"
implementation "com.android.support:support-annotations:${versions.supportLib}"
implementation "com.android.support:support-v4:${versions.supportLib}"
implementation "com.android.support:recyclerview-v7:${versions.supportLib}"

// mixed versions avoidance
implementation "com.android.support:exifinterface:${versions.supportLib}"

// constraint layout
implementation "com.android.support.constraint:constraint-layout:${versions.constraintLayuotLib}"
implementation 'cn.hugeterry.coordinatortablayout:coordinatortablayout:1.2.2'

// multi-dex
implementation 'com.android.support:multidex:1.0.3'

// picasso
implementation 'com.squareup.picasso:picasso:2.71828'

// testing
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

寻找朋友的摇篮

apply plugin: 'com.android.library'

android {
compileSdkVersion 27
defaultConfig {
    minSdkVersion 15
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')

// modules
implementation project(path: ':shared.resources')
implementation project(path: ':backend')

// ui
implementation 'com.github.florent37:materialtextfield:1.0.7'

// support
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'

testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:design:27.1.1'
}

intro.ui Gradle

intro.ui Gradle

apply plugin: 'com.android.library'

android {
compileSdkVersion 27
defaultConfig {
    minSdkVersion 15
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')

// modules
implementation project(path: ':backend')
implementation project(path: ':shared.resources')

// intro ui
implementation 'com.nightonke:boommenu:2.1.1'

// support
implementation "com.android.support:appcompat-v7:${versions.supportLib}"
implementation "com.android.support:support-v4:${versions.supportLib}"

// testing
implementation 'com.android.support.constraint:constraint-layout:1.1.2'

testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

lobkscreen.ui Gradle

lobkscreen.ui Gradle

apply plugin: 'com.android.library'

android {
compileSdkVersion 27
defaultConfig {
    minSdkVersion 15
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
// butterKnife is not used with this projects as issue #1130 with libraries
// @link (https://github.com/JakeWharton/butterknife/issues/1130)
// TODO (1) is there is any resource to learn from it how to comment and add clickable text?
// support
implementation "com.android.support:appcompat-v7:${versions.supportLib}"
implementation 'com.android.support:recyclerview-v7:27.1.1'
// constraint
implementation "com.android.support.constraint:constraint-layout:${versions.constraintLayuotLib}"
// animations
implementation 'com.jaredrummler:animated-svg-view:1.0.5'
// testing
testImplementation "junit:junit:${versions.junitLib}"
androidTestImplementation "com.android.support.test:runner:${versions.testRunnerLib}"
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

shared.resources Gradle

shared.resources Gradle

apply plugin: 'com.android.library'

android {
compileSdkVersion 27
defaultConfig {
    minSdkVersion 15
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')

// icons
implementation "com.mikepenz:iconics-core:3.0.4@aar"
implementation 'com.mikepenz:ionicons-typeface:2.0.1.4@aar'

// dialog ui
implementation 'com.afollestad.material-dialogs:core:0.9.6.0'

// support
implementation "com.android.support:appcompat-v7:${versions.supportLib}"

// mixed versions avoidance
implementation 'com.android.support:recyclerview-v7:27.1.1'

// timber
implementation "com.jakewharton.timber:timber:${versions.timberLib}"

// testing
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

推荐答案

您需要通过排除重复的类来防止重复的类:

you need to prevent duplicate classes, by excluding the duplicates:

implementation ("com.google.firebase:firebase-firestore:17.0.4") {
    exclude group: "com.google.protobuf"
}

可能是,您必须排除com.google.guava,而不是...

it may be, that you have to exclude com.google.guava, instead...

检查./gradlew :app:dependencies,然后添加所需的exclude语句.

check with ./gradlew :app:dependencies and then add the required exclude statements.

这篇关于使用高于15.0.0版本的FireStore会导致错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆