Ionic 4 Cordova - Run Android Firebase error all of a sudden

I followed all your steps. build is successful but while deploying the app to the device or running in the simulator, I am getting the following error:

Executing tasks: [:app:assembleDebug]

Configure project :app
Configuration ‘compile’ in project ‘:app’ is deprecated. Use ‘implementation’ instead.
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)

Task :app:preBuild UP-TO-DATE
Task :CordovaLib:preBuild UP-TO-DATE
Task :CordovaLib:preDebugBuild UP-TO-DATE
Task :CordovaLib:checkDebugManifest UP-TO-DATE
Task :CordovaLib:processDebugManifest UP-TO-DATE
Task :app:preDebugBuild UP-TO-DATE
Task :CordovaLib:compileDebugAidl UP-TO-DATE
Task :app:compileDebugAidl UP-TO-DATE
Task :CordovaLib:packageDebugRenderscript NO-SOURCE
Task :app:compileDebugRenderscript UP-TO-DATE
Task :app:checkDebugManifest UP-TO-DATE
Task :app:generateDebugBuildConfig UP-TO-DATE
Task :app:prepareLintJar UP-TO-DATE
Task :app:mergeDebugShaders UP-TO-DATE
Task :app:compileDebugShaders UP-TO-DATE
Task :app:generateDebugAssets UP-TO-DATE
Task :CordovaLib:mergeDebugShaders UP-TO-DATE
Task :CordovaLib:compileDebugShaders UP-TO-DATE
Task :CordovaLib:generateDebugAssets UP-TO-DATE
Task :CordovaLib:mergeDebugAssets UP-TO-DATE
Task :app:mergeDebugAssets UP-TO-DATE

Task :app:processDebugGoogleServices
Parsing json file: /Users/samarthagarwal/Desktop/FIREBASE/firebase analytics/MMAUIRepo/platforms/android/app/google-services.json

Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
Task :app:processDebugManifest UP-TO-DATE
Task :app:fabricGenerateResourcesDebug
Task :app:generateDebugResValues UP-TO-DATE
Task :app:generateDebugResources UP-TO-DATE
Task :CordovaLib:compileDebugRenderscript UP-TO-DATE
Task :CordovaLib:generateDebugResValues UP-TO-DATE
Task :CordovaLib:generateDebugResources UP-TO-DATE
Task :CordovaLib:packageDebugResources UP-TO-DATE
Task :app:mergeDebugResources
Task :app:splitsDiscoveryTaskDebug UP-TO-DATE
Task :CordovaLib:platformAttrExtractor UP-TO-DATE
Task :CordovaLib:processDebugResources UP-TO-DATE
Task :app:processDebugResources
Task :app:generateDebugSources
Task :CordovaLib:generateDebugBuildConfig UP-TO-DATE
Task :CordovaLib:prepareLintJar UP-TO-DATE
Task :CordovaLib:generateDebugSources UP-TO-DATE
Task :CordovaLib:javaPreCompileDebug

Task :CordovaLib:compileDebugJavaWithJavac
Note: /Users/samarthagarwal/Desktop/FIREBASE/firebase analytics/MMAUIRepo/platforms/android/CordovaLib/src/org/apache/cordova/engine/SystemCookieManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

Task :CordovaLib:processDebugJavaRes NO-SOURCE
Task :CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug
Task :app:javaPreCompileDebug

Task :app:compileDebugJavaWithJavac FAILED
/Users/samarthagarwal/Desktop/FIREBASE/firebase analytics/MMAUIRepo/platforms/android/app/src/main/java/com/google/cordova/plugin/BrowserTab.java:21: error: package android.support.customtabs does not exist
import android.support.customtabs.CustomTabsIntent;
^
/Users/samarthagarwal/Desktop/FIREBASE/firebase analytics/MMAUIRepo/platforms/android/app/src/main/java/com/adobe/phonegap/push/PushInstanceIDListenerService.java:9: error: cannot find symbol
import com.google.firebase.iid.FirebaseInstanceIdService;
^
symbol: class FirebaseInstanceIdService
location: package com.google.firebase.iid
/Users/samarthagarwal/Desktop/FIREBASE/firebase analytics/MMAUIRepo/platforms/android/app/src/main/java/com/adobe/phonegap/push/PushInstanceIDListenerService.java:15: error: cannot find symbol
public class PushInstanceIDListenerService extends FirebaseInstanceIdService implements PushConstants {
^
symbol: class FirebaseInstanceIdService
/Users/samarthagarwal/Desktop/FIREBASE/firebase analytics/MMAUIRepo/platforms/android/app/src/main/java/com/google/cordova/plugin/BrowserTab.java:104: error: package CustomTabsIntent does not exist
Intent customTabsIntent = new CustomTabsIntent.Builder().build().intent;
^
/Users/samarthagarwal/Desktop/FIREBASE/firebase analytics/MMAUIRepo/platforms/android/app/src/main/java/com/adobe/phonegap/push/PushInstanceIDListenerService.java:18: error: method does not override or implement a method from a supertype
@Override
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
5 errors

FAILURE: Build failed with an exception.

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

Compilation failed; see the compiler error output for details.

  • 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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use ‘–warning-mode all’ to show the individual deprecation warnings.
See Command-Line Interface

BUILD FAILED in 12s
35 actionable tasks: 9 executed, 26 up-to-date

Can you please help me with this.

I’ve followed all your steps as well . But build has been failed.

:preDebugBuild FAILED

FAILURE: Build failed with an exception.

* What went wrong:
1

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

BUILD FAILED in 3m 7s
    at ChildProcess.whenDone (/Users/test/Documents/projects/ionic/test-project/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:13453) 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:13453) [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.

1 Like

sir but in my case if i edit our project.properties and add above but after save and close file my changes removed automatically why sir plz help me sir?

The same error can be found in the failed travis build of PR in github repo
https://travis-ci.org/arnesson/cordova-plugin-firebase/jobs/529225437

I am using IONIC 3, Thanks! this worked for me!

Thanks! This works. But can anyone provide details for root cause of the issue

cordova.system.library.12=com.google.firebase:firebase-core:16.0.8

cordova.system.library.13=com.google.firebase:firebase-messaging:17.5.0

cordova.system.library.14=com.google.firebase:firebase-config:16.4.1

cordova.system.library.15=com.google.firebase:firebase-perf:16.2.4

this worked for me in 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-crash:+
cordova.system.library.7=com.google.firebase:firebase-config:16.4.1

Also had to add it to build.gradle:

compile "com.google.firebase:firebase-core:16.0.8"
compile "com.google.firebase:firebase-messaging:17.5.0"
compile "com.google.firebase:firebase-crash:+"
compile "com.google.firebase:firebase-config:16.4.1"

hi
i am create new project ionic3

step 1
add
ionic cordova plugin add cordova-plugin-firebase
npm install --save @ionic-native/firebase

step 2
change my 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

step 3
ionic cordova build android --minifycss --optimizejs --minifyjs --release

ok build
step 4
copy my project folder src to my new project ionic3

step 5
Add the plugins that we error when we run

step 6
change PACKAGE_NAME old in platform

step 7
ionic cordova build android --minifycss --optimizejs --minifyjs --release

ok build

Well, Sorry i can not good speak English

1 Like

Thank you so much. It is working fine

Hi people! I’ve read all yours replies and followed some links. I found a solution for me here.

I followed each point and during some of them, terminal give me warnings and error, but at last I can run and emulate perfectly again.

Changes found in my project after execute solution is only on package.json.

before: "cordova-plugin-firebase": "^1.0.5"
after: "cordova-plugin-firebase": "git+https://github.com/dpa99c/cordova-plugin-firebase.git#GH-1057-April-05-android-build-issue"

Anyway, I think must have a better solution.

Ok sir thanks i will try

Try this
ionic cordova platforms remove android
ionic cordova plugin remove cordova-plugin-firebase
ionic cordova platforms add android

1 Like

Thanks a lot, It worked for me as well
:slight_smile:

This solved my problem after 18 hours of debugging

the solution is : https://github.com/arnesson/cordova-plugin-firebase/issues/1057#issuecomment-490004765

rewrite platforms/android/app/build.gradle and platforms/android/project.properties by updating :

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

This seems more a workaround then a real solution… developers should avoid to change data in platform directotyor as well plugins directory because its are generated…

1 Like

Google support libraries are deprecated (April, I think). So you have to lock your libraries for now.

Try this, worked for me. You have to make changes in the FCM project files -