所有gms/firebase库必须使用完全相同的版本规范Android Studio [英] All gms/firebase libraries must use the exact same version specification Android Studio

查看:95
本文介绍了所有gms/firebase库必须使用完全相同的版本规范Android Studio的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这个问题已经问了很多次了,但我无法弄清楚.让我解释一下,5月2日firebase宣布Firebase Android SDK现在具有独立的版本号.在此处查看:

Google服务插件: classpath'com.google.gms:google-services:3.2.1'我有三个模块,这里是所有模块和项目的gradle文件.

项目gradle:

  buildscript {储存库{jcenter()mavenCentral()专家{网址"https://maven.google.com/"名称为"Google"}专家{网址'https://maven.fabric.io/public'}谷歌()}依赖项{classpath'com.android.tools.build:gradle:3.1.2'classpath'com.google.gms:google-services:3.2.1'classpath'org.greenrobot:greendao-gradle-plugin:3.2.2'classpath'io.fabric.tools:gradle:1.25.4'//注意:请勿在此处放置应用程序依赖项;他们属于//在各个模块的build.gradle文件中}}所有项目{储存库{jcenter()专家{url"https://jitpack.io"}专家{网址"https://maven.google.com/"名称为"Google"}谷歌()}}任务清理(类型:删除){删除rootProject.buildDir} 

应用程式gradle:

  apply plugin:'com.android.application'应用插件:"org.greenrobot.greendao"应用插件:"io.fabric"安卓 {compileSdkVersion 27buildToolsVersion '27 .0.3'defaultConfig {applicationId"com.xyz.xyz"minSdkVersion 16targetSdkVersion 27版本号97versionName"2.3.2"testInstrumentationRunner"android.support.test.runner.AndroidJUnitRunner"multiDexEnabled是resConfigs"en","hi"}dexOptions {javaMaxHeapSize"4072M"}buildTypes {调试{applicationIdSuffix".debug"}释放 {minifyEnabled falserinkResources为falseproguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'}}aaptOptions {cruncherEnabled =假}compileOptions {sourceCompatibility JavaVersion.VERSION_1_8targetCompatibility JavaVersion.VERSION_1_8}}绿岛{schemaVersion 62}依赖项{实现fileTree(include:['* .jar'],dir:'libs')androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2',{排除组:"com.android.support",模块:"support-annotations"})实现('com.facebook.android:facebook-android-sdk:[4,5)'){排除组:"com.android.support"}实现('com.crashlytics.sdk.android:crashlytics:2.9.1@aar'){可传递=真}实施项目(路径::library")实施项目(路径::showcase")实施项目(路径:':cropper')/*编译'org.projectlombok:lombok:1.16.16'*//* annotationProcessor'org.projectlombok:lombok:1.16.16'*/实施'com.android.support:appcompat-v7:27.1.1'实施'com.android.support:design:27.1.1'实施'com.android.support.constraint:constraint-layout:1.1.0'实施'com.android.support:recyclerview-v7:27.1.1'实施'com.android.support:cardview-v7:27.1.1'实施'com.android.support:support-v13:27.1.1'实施'com.android.support:customtabs:27.1.1'实现'com.android.support:multidex:1.0.3'实现'com.android.volley:volley:1.0.0'实施'com.google.code.gson:gson:2.8.2'实施'com.android.support:support-v4:27.1.1'实施'de.hdodenhof:circleimageview:1.3.0'实施'com.github.bumptech.glide:glide:3.7.0'实现'com.github.jd-alexander:LikeButton:0.2.1'实施'com.daimajia.swipelayout:library:1.2.0@aar'实施'com.google.android.gms:play-services-auth:15.0.1'实施'com.google.android.gms:play-services-location:15.0.1'实施'com.google.android.gms:play-services-gcm:15.0.1'实施'com.google.firebase:firebase-auth:15.1.0'实施'com.google.firebase:firebase-core:15.0.2'实施'com.google.firebase:firebase-config:15.0.2'实施'com.google.firebase:firebase-crash:15.0.2'实施'com.google.firebase:firebase-invites:15.0.1'实施'com.google.firebase:firebase-messaging:15.0.2'实施'com.hbb20:ccp:1.8'实施'com.googlecode.libphonenumber:libphonenumber:8.4.2'实施'org.greenrobot:greendao:3.2.2'实现'com.clevertap.android:clevertap-android-sdk:3.1.4'testImplementation'junit:junit:4.12'实现'android.arch.lifecycle:runtime:1.1.1'实现'android.arch.lifecycle:extensions:1.1.1'注解处理器"android.arch.lifecycle:compiler:1.1.1"实施'org.jetbrains:annotations:15.0'实施'com.aurelhubert:ahbottomnavigation:2.1.0'实施'com.squareup.picasso:picasso:2.5.2'实施'it.sephiroth.android.library.targettooltip:target-tooltip-library:1.3.15'实施'uk.co.chrisjenx:书法:2.3.0'实现'com.caverock:androidsvg:1.2.1'实现('com.crashlytics.sdk.android:crashlytics:2.9.1@aar'){可传递=真}}应用插件:"com.google.gms.google-services" 

农作物gradle

  Apply插件:'com.android.library'安卓 {compileSdkVersion 27buildToolsVersion '27 .0.3'defaultConfig {minSdkVersion 14targetSdkVersion 27版本代码1versionName'2.4.7'}compileOptions {sourceCompatibility JavaVersion.VERSION_1_8targetCompatibility JavaVersion.VERSION_1_8}lintOptions {abortOnError假}}依赖项{实施'com.android.support:appcompat-v7:27.1.1'实现"com.android.support:exifinterface:27.1.1"} 

库gradle:

  Apply插件:'com.android.library'安卓 {compileSdkVersion 27buildToolsVersion '27 .0.3'defaultConfig {minSdkVersion 15targetSdkVersion 27版本代码1versionName"1.0.0"}buildTypes {释放 {minifyEnabled falseproguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'}}compileOptions {sourceCompatibility JavaVersion.VERSION_1_8targetCompatibility JavaVersion.VERSION_1_8}}依赖项{实现fileTree(include:['* .jar'],dir:'libs')实施'com.android.support:appcompat-v7:27.1.1'testImplementation'junit:junit:4.12'} 

Showcase gradle:

  buildscript {储存库{jcenter()mavenCentral()专家{网址"https://maven.google.com/"名称为"Google"}谷歌()}依赖项{classpath'com.android.tools.build:gradle:3.1.2'}}应用插件:"com.android.library"应用插件:"maven"依赖项{储存库{mavenCentral()}实现'com.android.support:support-annotations:27.1.1'实施'com.android.support:support-v4:27.1.1'}安卓 {compileSdkVersion 27buildToolsVersion '27 .0.3'defaultConfig {minSdkVersion 15targetSdkVersion 27版本代码1versionName"1.0.0"}compileOptions {sourceCompatibility JavaVersion.VERSION_1_8targetCompatibility JavaVersion.VERSION_1_8}} 

解决方案

解决方案是:

将您的依赖项更改为12.0.1,并将gradle插件降级为3.2.1版.

关于在多模块应用中使用google-services 3.3,有一个已知问题.也就是说,在发布修复该错误的新版本之前,将Google服务降级到3.2.1可能是您唯一的选择.

I know this question has been asked many time but I couldn't figure this out. Let me explain on 2 may firebase has announced that Firebase Android SDKs now have independent version numbers. Check here : Firebase Android Release Notes

So I have changed all firebase libraries version numbers according to documentation in my project. After that Android Studio start showing Warning message on implementation 'com.google.android.gms:play-services-auth:15.0.1'

But it compiles and generating build successfully no error occurring and app running perfectly. After some day I have noticed some issue in Firebase crash logs about google-play-service in my production app. I don't know this happing due to changes or something else. So firstly I want to remove this error message in gradle file. Check:

Google Service plugin: classpath 'com.google.gms:google-services:3.2.1' I have three modules here is gradle file of all module and project.

Project gradle:

    buildscript {
    repositories {
        jcenter()
        mavenCentral()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        maven {
            url 'https://maven.fabric.io/public'
        }
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath 'com.google.gms:google-services:3.2.1'
        classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2'
        classpath 'io.fabric.tools:gradle:1.25.4'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
         jcenter()
        maven { url "https://jitpack.io" }
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        google()
    }
}

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

app gradle:

    apply plugin: 'com.android.application'
apply plugin: 'org.greenrobot.greendao'
apply plugin: 'io.fabric'

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "com.xyz.xyz"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 97
        versionName "2.3.2"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
        resConfigs "en", "hi"
    }
    dexOptions {
        javaMaxHeapSize "4072M"
    }

    buildTypes {
        debug {
            applicationIdSuffix ".debug"
        }
        release {
            minifyEnabled false
            shrinkResources false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    aaptOptions {
        cruncherEnabled = false
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

greendao {
    schemaVersion 62
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation('com.facebook.android:facebook-android-sdk:[4,5)') {
        exclude group: "com.android.support"
    }
    implementation('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {
        transitive = true
    }
    implementation project(path: ':library')
    implementation project(path: ':showcase')
    implementation project(path: ':cropper')
    /* compile 'org.projectlombok:lombok:1.16.16'*/
    /*annotationProcessor 'org.projectlombok:lombok:1.16.16'*/
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    implementation 'com.android.support:recyclerview-v7:27.1.1'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.android.support:support-v13:27.1.1'
    implementation 'com.android.support:customtabs:27.1.1'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.android.volley:volley:1.0.0'
    implementation 'com.google.code.gson:gson:2.8.2'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'de.hdodenhof:circleimageview:1.3.0'
    implementation 'com.github.bumptech.glide:glide:3.7.0'
    implementation 'com.github.jd-alexander:LikeButton:0.2.1'
    implementation 'com.daimajia.swipelayout:library:1.2.0@aar'
    implementation 'com.google.android.gms:play-services-auth:15.0.1'
    implementation 'com.google.android.gms:play-services-location:15.0.1'
    implementation 'com.google.android.gms:play-services-gcm:15.0.1'
    implementation 'com.google.firebase:firebase-auth:15.1.0'
    implementation 'com.google.firebase:firebase-core:15.0.2'
    implementation 'com.google.firebase:firebase-config:15.0.2'
    implementation 'com.google.firebase:firebase-crash:15.0.2'
    implementation 'com.google.firebase:firebase-invites:15.0.1'
    implementation 'com.google.firebase:firebase-messaging:15.0.2'
    implementation 'com.hbb20:ccp:1.8'
    implementation 'com.googlecode.libphonenumber:libphonenumber:8.4.2'
    implementation 'org.greenrobot:greendao:3.2.2'
    implementation 'com.clevertap.android:clevertap-android-sdk:3.1.4'
    testImplementation 'junit:junit:4.12'
    implementation 'android.arch.lifecycle:runtime:1.1.1'
    implementation 'android.arch.lifecycle:extensions:1.1.1'
    annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
    implementation 'org.jetbrains:annotations:15.0'
    implementation 'com.aurelhubert:ahbottomnavigation:2.1.0'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'it.sephiroth.android.library.targettooltip:target-tooltip-library:1.3.15'
    implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
    implementation 'com.caverock:androidsvg:1.2.1'
    implementation('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {
        transitive = true
    }
}

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

Cropper gradle

 apply plugin: 'com.android.library'

android {

    compileSdkVersion 27
    buildToolsVersion '27.0.3'
    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 27
        versionCode 1
        versionName '2.4.7'
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    lintOptions {
        abortOnError false
    }
}

dependencies {
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation "com.android.support:exifinterface:27.1.1"
}

Library gradle:

    apply plugin: 'com.android.library'

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'

    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 27
        versionCode 1
        versionName "1.0.0"
    }
    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')
    implementation 'com.android.support:appcompat-v7:27.1.1'
    testImplementation 'junit:junit:4.12'
}

SHowcase gradle:

    buildscript {
    repositories {
        jcenter()
        mavenCentral()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        google()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
    }
}

apply plugin: 'com.android.library'
apply plugin: 'maven'

dependencies {
    repositories {
        mavenCentral()
    }
    implementation 'com.android.support:support-annotations:27.1.1'
    implementation 'com.android.support:support-v4:27.1.1'
}

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'

    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 27
        versionCode 1
        versionName "1.0.0"
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

解决方案

The solution is:

Change your dependency to 12.0.1 and downgrade the gradle plugin to version 3.2.1.

There's a known issue about using google-services 3.3 in multimodule apps. That means downgrading to google-services to 3.2.1 may be your only option until a new version that fixes the bug is released.

这篇关于所有gms/firebase库必须使用完全相同的版本规范Android Studio的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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