FCM and Google plus compile issue


#1

Hi recently got following error when project compile

Could not resolve all files for configuration ‘:debugCompileClasspath’.

Could not find any version that matches com.google.android.gms:play-services-stats:11.+.
Versions that do not match:
15.0.1
15.0.0
Searched in the following locations:
file:/home/sameera/Android/Sdk/extras/m2repository/com/google/android/gms/play-services-stats/maven-metadata.xml
file:/home/sameera/Android/Sdk/extras/m2repository/com/google/android/gms/play-services-stats/
file:/home/sameera/Android/Sdk/extras/google/m2repository/com/google/android/gms/play-services-stats/maven-metadata.xml
file:/home/sameera/Android/Sdk/extras/google/m2repository/com/google/android/gms/play-services-stats/
file:/home/sameera/Android/Sdk/extras/android/m2repository/com/google/android/gms/play-services-stats/maven-metadata.xml
file:/home/sameera/Android/Sdk/extras/android/m2repository/com/google/android/gms/play-services-stats/
https://jcenter.bintray.com/com/google/android/gms/play-services-stats/maven-metadata.xml
https://maven.google.com/com/google/android/gms/play-services-stats/maven-metadata.xml
Required by:
project : > com.google.firebase:firebase-messaging:17.0.0 > com.google.firebase:firebase-iid:16.0.0
project : > com.google.firebase:firebase-core:16.0.0 > com.google.firebase:firebase-analytics:16.0.0
project : > com.google.firebase:firebase-core:16.0.0 > com.google.firebase:firebase-analytics:16.0.0 > com.google.firebase:firebase-analytics-impl:16.0.0
Could not find any version that matches com.google.android.gms:play-services-measurement-base:11.+.
Versions that do not match:
15.0.4
15.0.2
15.0.0
Searched in the following locations:
file:/home/sameera/Android/Sdk/extras/m2repository/com/google/android/gms/play-services-measurement-base/maven-metadata.xml
file:/home/sameera/Android/Sdk/extras/m2repository/com/google/android/gms/play-services-measurement-base/
file:/home/sameera/Android/Sdk/extras/google/m2repository/com/google/android/gms/play-services-measurement-base/maven-metadata.xml
file:/home/sameera/Android/Sdk/extras/google/m2repository/com/google/android/gms/play-services-measurement-base/
file:/home/sameera/Android/Sdk/extras/android/m2repository/com/google/android/gms/play-services-measurement-base/maven-metadata.xml
file:/home/sameera/Android/Sdk/extras/android/m2repository/com/google/android/gms/play-services-measurement-base/
https://jcenter.bintray.com/com/google/android/gms/play-services-measurement-base/maven-metadata.xml
https://maven.google.com/com/google/android/gms/play-services-measurement-base/maven-metadata.xml
Required by:
project : > com.google.firebase:firebase-core:16.0.0 > com.google.firebase:firebase-analytics:16.0.0
project : > com.google.firebase:firebase-core:16.0.0 > com.google.firebase:firebase-measurement-connector-impl:16.0.0
project : > com.google.firebase:firebase-core:16.0.0 > com.google.firebase:firebase-analytics:16.0.0 > com.google.firebase:firebase-analytics-impl:16.0.0
Could not find any version that matches com.google.android.gms:play-services-ads-identifier:11.+.
Versions that do not match:
15.0.1
15.0.0
Searched in the following locations:
file:/home/sameera/Android/Sdk/extras/m2repository/com/google/android/gms/play-services-ads-identifier/maven-metadata.xml
file:/home/sameera/Android/Sdk/extras/m2repository/com/google/android/gms/play-services-ads-identifier/
file:/home/sameera/Android/Sdk/extras/google/m2repository/com/google/android/gms/play-services-ads-identifier/maven-metadata.xml
file:/home/sameera/Android/Sdk/extras/google/m2repository/com/google/android/gms/play-services-ads-identifier/
file:/home/sameera/Android/Sdk/extras/android/m2repository/com/google/android/gms/play-services-ads-identifier/maven-metadata.xml
file:/home/sameera/Android/Sdk/extras/android/m2repository/com/google/android/gms/play-services-ads-identifier/
https://jcenter.bintray.com/com/google/android/gms/play-services-ads-identifier/maven-metadata.xml
https://maven.google.com/com/google/android/gms/play-services-ads-identifier/maven-metadata.xml
Required by:
project : > com.google.firebase:firebase-core:16.0.0 > com.google.firebase:firebase-analytics:16.0.0 > com.google.firebase:firebase-analytics-impl:16.0.0

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

  • Get more help at https://help.gradle.org

BUILD FAILED in 10s

[ERROR] An error occurred while running cordova build android (exit code 1).


#2

You need to specify all the same versions for FCM and Google plugin (google maps)

Here is example how to do.


#4

I changed into same version in both .xml files as follows

now the error as follows

BUILD FAILED

Total time: 5.626 secs
Error: /home/sameera/workspaceLuna/****/platforms/android/gradlew: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:processDebugGoogleServices’.

Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 9.0.0.


#5

9.0.0 is too old.
Specify 16.0.0, then cordova clear


#6

I tried then after I getting first error which I mentioned at the top


#7

#8

Finally got work. Thank you very much for the guide wf9a5m75 I followed folowing steps to resolve issue. If someone need follow this step and correct me if I’m wrong.
My environment
cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.19.2
ionic (Ionic CLI) : 3.20.0

global packages:

cordova (Cordova CLI) : 7.0.1

local packages:

Cordova Platforms : android 6.4.0
Ionic Framework   : ionic1 1.3.1

System:

Android SDK Tools : 26.1.1
Node              : v8.9.1
npm               : 6.1.0
OS                : Linux 4.13

1)After adding both google and fcm plugin remove android platform using
$ cordova plugin add cordova-plugin-googleplus
$ cordova plugin add cordova-plugin-fcm
$ ionic cordova platform remove android
2)Then edit ProjectName/plugins/cordova-plugin-fcm/src/android/FCMPlugin.gradle
as follows

<--------------------------FCMPlugin.gradle------------------------>

buildscript {
	repositories {
            jcenter()
			mavenLocal()
        }
    dependencies {
        classpath 'com.android.tools.build:gradle:+'
        classpath 'com.google.gms:google-services:3.0.0'
    }
}
// apply plugin: 'com.google.gms.google-services'
// class must be used instead of id(string) to be able to apply plugin from non-root gradle file
//apply plugin: com.google.gms.googleservices.GoogleServicesPlugin


ext.postBuildExtras = {
    apply plugin: com.google.gms.googleservices.GoogleServicesPlugin
}

<--------------------------FCMPlugin.gradle------------------------/>

3)Then edit ProjectName/plugins/cordova-plugin-fcm/plugin.xml as follows

<framework src="com.google.firebase:firebase-core:11.8.0" />
	<framework src="com.google.firebase:firebase-messaging:11.8.0" />

4)Afterwords add platform again
$ ionic cordova platform add android@~6.4.0
5)Then build the project. This could failed again. If it is goto
ProjectName/platforms/android/project.properties
and edit as follows

target=android-26
	android.library.reference.1=CordovaLib
	cordova.gradle.include.1=cordova-android-play-services-gradle-release/buzzflownewdesign-cordova-android-play-services-gradle-release.gradle
	cordova.system.library.1=com.google.firebase:firebase-core:11.8.0
	cordova.system.library.2=com.google.firebase:firebase-messaging:11.8.0
	cordova.gradle.include.2=cordova-plugin-fcm/buzzflownewdesign-FCMPlugin.gradle
	cordova.system.library.3=com.google.android.gms:play-services-auth:11.8.0
	cordova.system.library.4=com.google.android.gms:play-services-identity:11.8.0