Firebase plugin


#1

we are using firebase analytics plugin . Everything works fine, but when we try to make an iOS build for distribution we get build error. Whereas, just removing the plugin we get build successful. What should be the recommended way for ionic 3.19.0 app wrapped on cordova 7 or 8 ?

thanks


#2

write your error here plz


#3

Configuration ‘compile’ in project ‘:app’ is deprecated. Use ‘implementation’ instead.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_drpicextdm6z8hklacqmzhji5.run(/Users/itcinfotech/Documents/Ionic Project/onzv_release/project_name/platforms/android/app/build.gradle:146)

FAILURE: Build failed with an exception.

  • Where:
    Script ‘/Users/itcinfotech/Documents/Ionic Project/onzv_release/project_name/platforms/android/cordova-support-google-services/project_name-build.gradle’ line: 16

  • What went wrong:
    A problem occurred evaluating project ‘:app’.

Failed to apply plugin [class ‘com.google.gms.googleservices.GoogleServicesPlugin’]
Cannot add extension with name ‘googleServices’, as there is an extension already registered with that name.

  • 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 22s
(node:6051) UnhandledPromiseRejectionWarning: Error: /Users/itcinfotech/Documents/Ionic Project/onzv_release/project_name/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

  • Where:
    Script ‘/Users/itcinfotech/Documents/Ionic Project/onzv_release/project_name/platforms/android/cordova-support-google-services/project_name-build.gradle’ line: 16

  • What went wrong:
    A problem occurred evaluating project ‘:app’.

Failed to apply plugin [class ‘com.google.gms.googleservices.GoogleServicesPlugin’]
Cannot add extension with name ‘googleServices’, as there is an extension already registered with that name.

  • 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 22s
at ChildProcess.whenDone (/Users/itcinfotech/Documents/Ionic Project/onzv_release/project_name/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
at ChildProcess.emit (events.js:182:13)
at maybeClose (internal/child_process.js:962:16)
at Socket.stream.socket.on (internal/child_process.js:381:11)
at Socket.emit (events.js:182:13)
at Pipe._handle.close (net.js:606:12)
(node:6051) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either bythrowing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:6051) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I am really stuck on this. please help. if there are other separate plugins which work for iOS and android separately, i am willing to experiment. But I can not remove firebase analytics plugin, as it is too much of work now

thanks in advance


#4

did you add google-services.json file ?
if
you add it you will find soluation here

else add it .


#5

thanks , lemme try, but

will this single plugin work for firebase push notification as well as firebase analytics ? I know if i remove the firebase analytics plugin this thing works, now i am thinking if this solves my problem of firebase analytics problem, i dont need to add 2 plugins to achieve these functionalities , right ?
any instructions how to use this, for firebase analytics, if at all it is there !

thanks


#6

yes, we have added google-services.json file. without that our firebase analytics would not have worked ! the firebase analytics plugin works perfect, only when we add push notification plugin we start getting these weird errors.

now i get this

FAILURE: Build failed with an exception.

  • What went wrong:
    The library com.google.android.gms:play-services-analytics-impl is being requested by various other libraries at [[16.0.1,16.0.1]], but resolves to 16.0.4. Disable the plugin and check yourdependencies tree using ./gradlew :app:dependencies.

  • 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 4s
at ChildProcess.whenDone (/Users/itcinfotech/Documents/Ionic Project/onzv_release/project_name/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
at ChildProcess.emit (events.js:182:13)
at maybeClose (internal/child_process.js:962:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
(node:5077) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:5077) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

CORDOVA.SUPPORT.GOOGLESERVICES.GRADLE

buildscript {
repositories {
jcenter()
mavenCentral()
}

dependencies {
    classpath 'com.android.tools.build:gradle:2.2.1'
    classpath 'com.google.gms:google-services:3.1.1'
}

}

// 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
ext.postBuildExtras = {
//com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
}

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-firebase/project_name-build.gradle
cordova.system.library.1=com.google.android.gms:play-services-tagmanager:11.8.0
cordova.system.library.2=com.google.firebase:firebase-core:11.8.0
cordova.system.library.3=com.google.firebase:firebase-messaging:11.8.0
cordova.system.library.4=com.google.firebase:firebase-config:11.8.0
cordova.system.library.5=com.google.firebase:firebase-perf:11.8.0
cordova.gradle.include.2=cordova-support-google-services/project_name-build.gradle
cordova.system.library.6=com.google.firebase:firebase-core:16.0.11.8.0
cordova.system.library.7=com.google.android.gms:play-services-analytics:16.0.1
cordova.system.library.8=com.android.support:support-annotations:27.+
cordova.gradle.include.3=cordova-plugin-iroot/project_name-build-extras.gradle

BUILD.GRADLE

dependencies {
implementation fileTree(dir: ‘libs’, include: ‘*.jar’)
// SUB-PROJECT DEPENDENCIES START
implementation(project(path: “:CordovaLib”))
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.google.firebase:firebase-core:16.0.+”
compile “com.google.android.gms:play-services-analytics:16.0.1”
compile “com.android.support:support-annotations:27.+”
// SUB-PROJECT DEPENDENCIES END
}


#7

We managed to resolve android issue. We still get into duplicate symbol problems in Xcode. How to resolve this ?
With the amount of time it taking for resolving this issue, I am thinking of writing my own plugin, but how to disable this plugin for iOS ?

tx