离子:谷歌 Firebase 更新破坏了构建

Posted

技术标签:

【中文标题】离子:谷歌 Firebase 更新破坏了构建【英文标题】:Ionic : google Firebase update broke the build 【发布时间】:2019-11-14 06:17:00 【问题描述】:

我知道自从 google 发布新的 firebase 版本几周以来,这种问题已经多次出现;

经过一些调整,很多人似乎成功编译,但我无法让我的应用在 android 中编译。

我花了几个小时寻找答案,但我被困住了!

这是错误:

The library com.google.firebase:firebase-iid is being requested by various other libraries at [[17.1.1,17.1.1]], but resolves to 19.0.0. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.

我什至试过这个https://github.com/arnesson/cordova-plugin-firebase/issues/1081#issuecomment-503041641,但它没有任何改变 (看来他用的这个脚本什么都没做)

这是我的project.properties

# This file was originally created by the Android Tools, but is now
# used by cordova-android to manage the state of the various third party
# libraries used in your application

# This is the Library Module that contains the Cordova Library, this is not
# required when using an AAR

# This is the application project.  This is only required for Android Studio Gradle projects

# Project target.
target=android-27
android.library.reference.1=CordovaLib
android.library.reference.2=app
cordova.gradle.include.1=cordova-plugin-badge/app-badge.gradle
cordova.system.library.1=com.android.support:support-v4:27.1.0
cordova.system.library.2=com.soundcloud.android:android-crop:1.0.0@aar
cordova.system.library.3=com.facebook.android:facebook-android-sdk:4.+
cordova.gradle.include.2=cordova-plugin-firebase/app-build.gradle
cordova.system.library.4=com.google.android.gms:play-services-tagmanager:+
cordova.system.library.5=com.google.firebase:firebase-core:16.0.8
cordova.system.library.6=com.google.firebase:firebase-messaging:17.5.0
cordova.system.library.7=com.google.firebase:firebase-config:16.4.1
cordova.system.library.8=com.google.firebase:firebase-perf:16.2.4
cordova.system.library.8=com.google.firebase:firebase-iid:17.1.1
cordova.system.library.9=com.google.android.gms:play-services-auth:11.8.0
cordova.system.library.10=com.google.android.gms:play-services-identity:11.8.0
cordova.gradle.include.3=cordova-plugin-local-notification/app-localnotification.gradle
cordova.system.library.12=com.android.support:appcompat-v7:23+
cordova.gradle.include.4=cordova-plugin-telerik-imagepicker/app-ignorelinterrors.gradle
cordova.gradle.include.5=cordova-plugin-telerik-imagepicker/app-androidtarget.gradle
cordova.gradle.include.6=cordova-support-google-services/app-build.gradle

android/build.gradle

/* Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements.  See the NOTICE file
   distributed with this work for additional information
   regarding copyright ownership.  The ASF licenses this file
   to you under the Apache License, Version 2.0 (the
   "License"); you may not use this file except in compliance
   with the License.  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing,
   software distributed under the License is distributed on an
   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   KIND, either express or implied.  See the License for the
   specific language governing permissions and limitations
   under the License.
*/

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

buildscript 
    repositories 
        maven 
            url "https://maven.google.com"
        
        jcenter()
        maven  url 'https://maven.fabric.io/public'  // Fabrics Maven repository from cordova-plugin-firebase
    
    dependencies 

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.google.gms:google-services:4.1.0' // google-services dependency from cordova-plugin-firebase
        classpath 'io.fabric.tools:gradle:1.25.4' // fabric dependency from cordova-plugin-firebase
        // 
        // implementation "com.google.firebase:firebase-iid:17.1.1"
    




allprojects 
    repositories 
        maven 
            url "https://maven.google.com"
        
        jcenter()
        google() // Google's Maven repository from cordova-plugin-firebase
    
    //This replaces project.properties w.r.t. build settings
    project.ext 
      defaultBuildToolsVersion="28.0.1" //String
      defaultMinSdkVersion=19 //Integer - Minimum requirement is Android 4.4
      defaultTargetSdkVersion=28 //Integer - We ALWAYS target the latest by default
      defaultCompileSdkVersion=28 //Integer - We ALWAYS compile with the latest by default
    


task clean(type: Delete) 
    delete rootProject.buildDir


// com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true// i dont like this

有什么想法吗?

谢谢!

【问题讨论】:

***.com/a/56656680/777265 【参考方案1】:

依赖项的顺序很重要。尝试在之后 firebase-core 设置firebase:firebase-iid:17.1.1

另外,为 tagmanager 指定一个确切的版本并添加 firebase auth 依赖项: cordova.system.library.15=com.google.android.gms:play-services-tagmanager:16.0.8 cordova.system.library.16=com.google.firebase:firebase-auth:16.2.0

【讨论】:

以上是关于离子:谷歌 Firebase 更新破坏了构建的主要内容,如果未能解决你的问题,请参考以下文章

尝试离子构建时出现角度firebase构建错误

离子生命周期取消/订阅 Firebase 数据库流(使用异步管道)

Firebase 工具破坏了我的 webapp 依赖项

新标记已更新其位置,但旧标记未在离子原生谷歌地图中删除

离子幻灯片样式宽度自动设置

无法构建模块 Firebase