Hello,
I’m struggling on building an app that has two native plugins that uses google services.
It seems to be some gradle dependency conflict, I’m new to Ionic and to mobile development, it would be great if you guys could show me why this problem is happening.
I’m following the oficial documentation and completely lost on how to handle this type of error.
Steps to reproduce it:
- Create some ionic-angular project
ionic start someProjectName super --type=ionic-angular
- Add the ‘Push’ native plugin to the project exactly like the documentation (https://ionicframework.com/docs/v3/native/push/)
ionic cordova plugin add phonegap-plugin-push
npm install --save @ionic-native/push@4
- Add the ‘Firebase analytics’ native plugin to the project exactly like the documentation (https://ionicframework.com/docs/v3/native/firebase-analytics/)
ionic cordova plugin add cordova-plugin-firebase-analytics
npm install --save @ionic-native/firebase-analytics@4
- Add the android platform
ionic cordova platform add android
-
Create a firebase project and put the google-services.json inside platforms/android/app
-
Try to build it for android
ionic cordova build android
Then, you will get this log:
[10:40:03] ionic-app-scripts 3.2.4
[10:40:03] build dev started ...
[10:40:03] clean started ...
[10:40:03] clean finished in 10 ms
[10:40:03] copy started ...
[10:40:05] deeplinks started ...
[10:40:05] deeplinks finished in 115 ms
[10:40:05] transpile started ...
[10:40:18] transpile finished in 13.22 s
[10:40:18] preprocess started ...
[10:40:18] preprocess finished in 1 ms
[10:40:18] webpack started ...
[10:40:19] copy finished in 15.60 s
[10:40:26] webpack finished in 8.32 s
[10:40:26] sass started ...
[10:40:30] sass finished in 3.29 s
[10:40:30] postprocess started ...
[10:40:30] postprocess finished in 38 ms
[10:40:30] lint started ...
[10:40:30] build dev finished in 27.01 s
[10:40:37] lint finished in 7.72 s
> cordova.cmd build android
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=D:\Users\ALUNOS\AppData\Local\Android\Sdk (DEPRECATED)
> Task :wrapper
BUILD SUCCESSFUL in 2s
1 actionable task: 1 executed
Subproject Path: CordovaLib
Subproject Path: app
> Configure project :app
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
> Task :app:preBuild UP-TO-DATE
> Task :CordovaLib:preBuild UP-TO-DATE
> Task :CordovaLib:preDebugBuild UP-TO-DATE
> Task :CordovaLib:checkDebugManifest
> Task :CordovaLib:processDebugManifest
> Task :app:preDebugBuild FAILED
Dependency resolved to an incompatible version: Dependency(fromArtifactVersion=ArtifactVersion(groupId=com.google.firebase, artifactId=firebase-messaging, version=17.0.0), toArtifact=Artifact(groupId=com.google.firebase, artifactId=firebase-iid), toArtifactVersionString=[16.0.0])
3 actionable tasks: 3 executed
FAILURE: Build failed with an exception.
* What went wrong:
Failed to capture fingerprint of input files for task ':app:preDebugBuild' property 'compileManifests' during up-to-date check.
> In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[16.0.
0]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.
Dependency failing: com.google.firebase:firebase-messaging:17.0.0 -> com.google.firebase:firebase-iid@[16.0.0], but fire
base-iid version was 19.0.0.
The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
ifact with the issue.
-- Project 'app' depends onto com.google.firebase:firebase-messaging@17.0.+
-- Project 'app' depends onto com.google.firebase:firebase-analytics@17.2.1
-- Project 'app' depends onto com.google.firebase:firebase-iid@19.0.0
-- Project 'app' depends onto com.google.firebase:firebase-analytics@17.2.+
-- Project 'app' depends onto com.google.android.gms:play-services-measurement-api@17.2.1
-- Project 'app' depends onto com.google.firebase:firebase-messaging@17.0.0
For extended debugging info execute Gradle from the command line with ./gradlew --info :app:assembleDebug to see the dep
endency paths to the artifact. This error message came from the google-services Gradle plugin, report issues at https://
github.com/google/play-services-plugins and disable by adding "googleServices { disableVersionCheck = false }" to your b
uild.gradle file.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 7s
D:\Users\ALUNOS\Desktop\AT\Desenvolvimento\Apps\teste-analytics-2\someProjectName\platforms\android\gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
Failed to capture fingerprint of input files for task ':app:preDebugBuild' property 'compileManifests' during up-to-date check.
> In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[16.0.
0]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.
Dependency failing: com.google.firebase:firebase-messaging:17.0.0 -> com.google.firebase:firebase-iid@[16.0.0], but fire
base-iid version was 19.0.0.
The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
ifact with the issue.
-- Project 'app' depends onto com.google.firebase:firebase-messaging@17.0.+
-- Project 'app' depends onto com.google.firebase:firebase-analytics@17.2.1
-- Project 'app' depends onto com.google.firebase:firebase-iid@19.0.0
-- Project 'app' depends onto com.google.firebase:firebase-analytics@17.2.+
-- Project 'app' depends onto com.google.android.gms:play-services-measurement-api@17.2.1
-- Project 'app' depends onto com.google.firebase:firebase-messaging@17.0.0
For extended debugging info execute Gradle from the command line with ./gradlew --info :app:assembleDebug to see the dep
endency paths to the artifact. This error message came from the google-services Gradle plugin, report issues at https://
github.com/google/play-services-plugins and disable by adding "googleServices { disableVersionCheck = false }" to your b
uild.gradle file.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 7s
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
Until adding the analytics plugin at step 3, you should be fine on building it, the problem is occuring when both plugins are installed.