我在一个离子项目中遇到了一个问题,它昨天开始发生而没有修改任何依赖项。
运行ionic cordova run android
时出现此错误:
The library com.google.android.gms:play-services-measurement-base is being requested by various other libraries at [[16.5.0,16.5.0], [16.4.0,16.4.0]], but resolves to 16.5.0. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.
但是这些天我没有安装任何依赖项。
这是我的cordova plugins
列表:
cordova-fabric-plugin 1.1.14-dev "cordova-fabric-plugin"
cordova-plugin-advanced-http 2.0.9 "Advanced HTTP plugin"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-appminimize 1.0.1 "AppMinimize"
cordova-plugin-apprate 1.4.0 "AppRate"
cordova-plugin-appsee 2.6.0 "Appsee"
cordova-plugin-badge 0.8.8 "Badge"
cordova-plugin-datepicker 0.9.3 "DatePicker"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-dialogs 2.0.1 "Notification"
cordova-plugin-facebook4 3.2.0 "Facebook Connect"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-firebase 2.0.5 "Google Firebase Plugin"
cordova-plugin-freshchat 1.2.0 "Freshchat plugin for Phonegap"
cordova-plugin-geolocation 4.0.1 "Geolocation"
cordova-plugin-globalization 1.11.0 "Globalization"
cordova-plugin-inappbrowser 3.0.0 "InAppBrowser"
cordova-plugin-inapppurchase-fixed 1.1.0 "In App Purchase"
cordova-plugin-insomnia 4.3.0 "Insomnia (prevent screen sleep)"
cordova-plugin-local-notification 0.9.0-beta.2 "LocalNotification"
cordova-plugin-media 5.0.2 "Media"
cordova-plugin-nativegeocoder 3.2.2 "NativeGeocoder"
cordova-plugin-nativestorage 2.3.2 "NativeStorage"
cordova-plugin-network-information 2.0.1 "Network Information"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-plugin-x-socialsharing 5.4.4 "SocialSharing"
cordova-support-google-services 1.2.1 "cordova-support-google-services"
es6-promise-plugin 4.2.2 "Promise"
ionic-plugin-deeplinks 1.0.19 "Ionic Deeplink Plugin"
nl.kingsquare.cordova.background-audio 1.0.1 "background-audio"
pushwoosh-cordova-plugin 7.13.0 "Pushwoosh"
我在platforms/android/app/build.gradle
中发现了这些依赖关系(如果很高兴知道):
dependencies {
implementation fileTree(dir: 'libs', include: '*.jar')
// SUB-PROJECT DEPENDENCIES START
implementation(project(path: ":CordovaLib"))
compile "com.android.support:support-v4:24.1.1+"
compile "com.squareup.okhttp3:okhttp-urlconnection:3.10.0"
compile "com.google.android.gms:play-services-tagmanager:+"
compile "com.google.firebase:firebase-core:+"
compile "com.google.firebase:firebase-messaging:+"
compile "com.google.firebase:firebase-config:+"
compile "com.google.firebase:firebase-perf:+"
compile "com.android.support:support-v4:26.+"
compile "com.android.support:support-v4:27.+"
compile "com.android.support:appcompat-v7:27.+"
compile "com.android.support:recyclerview-v7:27.+"
compile "com.android.support:design:27.+"
compile "com.android.support.constraint:constraint-layout:1.0.2"
compile "com.github.bumptech.glide:glide:4.7.1"
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.60"
compile "com.pushwoosh:pushwoosh:5.13.0"
compile "com.pushwoosh:pushwoosh-amazon:5.13.0"
compile "com.pushwoosh:pushwoosh-badge:5.13.0"
compile "com.pushwoosh:pushwoosh-inbox:5.13.0"
compile "com.pushwoosh:pushwoosh-inbox-ui:5.13.0"
compile "com.facebook.android:facebook-android-sdk:4.38.1"
compile "com.appsee:appsee-android:2.6.0"
// SUB-PROJECT DEPENDENCIES END
}
我不知道在哪里搜索。我发现有一种变通办法,正在platforms/android/build.gradle
中禁用GoogleServicesPlugin的版本检查:com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
,但对我不起作用。
谢谢。
编辑:似乎我不是唯一的一个。 Here。
答案 0 :(得分:31)
这里没有发布的解决方案对我有用。一个很棒的人在cordova-firebase-plugin
官方仓库中打开了一个pull request,它可以正常工作。
我执行的步骤:
1-使用ionic cordova plugin remove cordova-plugin-firebase
删除cordova-firebase-plugin
2-安装:ionic cordova plugin add https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue
3-rm -rf node_modules/ plugins/ platforms/android package-lock.json
4-ionic cordova platform add android && npm install
5-就我而言,我还使用旧版本的firebase js库,因为最新版本对我不起作用。使用该库,我总是需要在完成所有前面的步骤后手动重新安装它,所以我也做了:npm install firebase@4.12.1
。
现在可以正常工作了。
答案 1 :(得分:16)
我在Yannic Hamann答案(Ionic Forum)中提到的论坛中为我找到了解决方案。
systems_qualigy here中的评论是关于将版本锁定在project.properties中。
cordova.system.library.4=com.google.firebase:firebase-core:16.0.8
cordova.system.library.5=com.google.firebase:firebase-messaging:17.5.0
cordova.system.library.6=com.google.firebase:firebase-config:16.4.1
cordova.system.library.7=com.google.firebase:firebase-perf:16.2.4
我还需要锁定版本
com.google.android.gms:play-services-tagmanager:16.0.8
我从Martins的答案中获取了该版本,并可以成功地重建我的项目。
答案 2 :(得分:3)
按照说的做,然后在Andoird项目目录中运行./gradlew :app:dependencies
。
support-v4
甚至被添加了三遍:
compile "com.android.support:support-v4:24.1.1+"
compile "com.android.support:support-v4:26.+"
compile "com.android.support:support-v4:27.+"
与此类似,Gradle项目同步:
implementation project(":CordovaLib")
implementation "com.google.android.gms:play-services-tagmanager:16.0.8"
implementation "com.google.firebase:firebase-messaging:18.0.0"
implementation "com.google.firebase:firebase-config:17.0.0"
implementation "com.google.firebase:firebase-perf:17.0.0"
implementation "com.google.firebase:firebase-core:16.0.9"
implementation "com.android.support:design:28.0.0"
implementation "com.android.support:support-v4:28.0.0"
implementation "com.android.support:customtabs:28.0.0"
implementation "com.android.support:appcompat-v7:28.0.0"
implementation "com.android.support:recyclerview-v7:28.0.0"
implementation "com.android.support:animated-vector-drawable:28.0.0"
implementation "com.android.support.constraint:constraint-layout:1.1.3"
implementation "com.facebook.android:facebook-android-sdk:4.42.0"
implementation "com.squareup.okhttp3:okhttp-urlconnection:3.10.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.60"
implementation "com.github.bumptech.glide:glide:4.9.0"
implementation "com.appsee:appsee-android:2.6.0"
implementation "com.pushwoosh:pushwoosh:5.13.0"
implementation "com.pushwoosh:pushwoosh-amazon:5.13.0"
implementation "com.pushwoosh:pushwoosh-badge:5.13.0"
implementation "com.pushwoosh:pushwoosh-inbox:5.13.0"
implementation "com.pushwoosh:pushwoosh-inbox-ui:5.13.0"
答案 3 :(得分:3)
该问题是由于firebase中的最新更新导致不赞成使用某些方法,请查看https://firebase.google.com/support/release-notes/android。 要解决此问题,请使用以下cordova插件补丁:
cordova plugin add https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue
答案 4 :(得分:2)
我遇到了完全相同的问题。该问题是由cordova-plugin-firebase
引起的。我目前正在调查。找到确切的课程后,将更新此答案。
现在您可以尝试ionic cordova plugin rm <plugin>
来查看这是否也解决了您当前的错误。
答案 5 :(得分:2)
我刚刚在android平台目录下的project.properties中添加了以下内容,并且可以正常使用
cordova.system.library.4=com.google.firebase:firebase-core:16.0.8
cordova.system.library.5=com.google.firebase:firebase-messaging:17.5.0
cordova.system.library.6=com.google.firebase:firebase-config:16.4.1
cordova.system.library.7=com.google.firebase:firebase-perf:16.2.4
答案 6 :(得分:2)
我们现在正在维护一个分叉版本,其中包括不同作者(谁使所有人都摆脱了Google的举动)所做的所有更改和修复。
https://github.com/wizpanda/cordova-plugin-firebase-lib#difference-from-the-fork-repository
因此,现在只需使用以下命令删除现有插件:
ionic cordova plugin remove cordova-plugin-firebase
现在,使用
安装新版本ionic cordova plugin add cordova-plugin-firebase-lib --save
干杯!
答案 7 :(得分:1)
我遇到了同样的错误,只是我删除了platform / android并重新安装(离子Cordova准备android),然后一切恢复原状
答案 8 :(得分:1)
离子4:20-05-2019
这对我有用:
platforms / android / project.properties
target=android-27
android.library.reference.1=CordovaLib
android.library.reference.2=app
cordova.system.library.1=com.squareup.okhttp3:okhttp-urlconnection:3.10.0
cordova.gradle.include.1=cordova-plugin-firebase/com1-build.gradle
cordova.system.library.2=com.google.android.gms:play-services-tagmanager:16.0.8
cordova.system.library.3=com.google.firebase:firebase-core:16.0.8
cordova.system.library.4=com.google.firebase:firebase-messaging:17.5.0
cordova.system.library.5=com.google.firebase:firebase-config:16.4.1
cordova.system.library.6=com.google.firebase:firebase-perf:16.2.4
cordova.system.library.7=com.android.support:support-annotations:27.+
答案 9 :(得分:0)
首先,尝试使用删除Firebase
ionic cordova plugin rm cordova-plugin-firebase
然后重新安装。
答案 10 :(得分:0)
按照我对科尔多瓦火力基地问题的完美解决方案。
新的cordova-plugin-firebasex插件将解决与firebase相关的所有问题,对于cordova-plugin-firebase来说,它确实是一个很好的选择。