我知道,自从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
有什么想法吗?
谢谢!
答案 0 :(得分:0)
依赖关系的顺序很重要。尝试在之后 firebase:firebase-iid:17.1.1
的右侧设置firebase-core
。
另外,为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