Getting apk build failure when using ionic-native/push and ionic-native/background-geolocation

Hi All,

I am using Ionic 3 in my project.
I am trying to use ionic-native/push plugin and ionic-native/background-geolocation

But as i build my application apk i get the build failure which says like below -

C:\wamp64\www\git_workspace\experiments\ionic3-background-geo\platforms\android\app\src\main\java\com\marianhello\bgloc\data\BackgroundActivity.java:20: error: cannot access zzbfm
        confidence = activity.getConfidence();
                             ^
  class file for com.google.android.gms.internal.zzbfm not found
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.
1 error
:app:compileDebugJavaWithJavac FAILED

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.

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

BUILD FAILED in 18s
28 actionable tasks: 2 executed, 26 up-to-date
cmd: Command failed with exit code 1 Error output:
C:\wamp64\www\git_workspace\experiments\ionic3-background-geo\platforms\android\app\src\main\java\com\marianhello\bgloc\data\BackgroundActivity.java:20: error: cannot access zzbfm
        confidence = activity.getConfidence();
                             ^
  class file for com.google.android.gms.internal.zzbfm not found
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.
1 error

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.

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

BUILD FAILED in 18s
[ERROR] An error occurred while running subprocess Cordova.

        Cordova build android exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.

ionic cordova plugins

> cordova plugin ls
call-number 0.0.2 "Cordova Call Number Plugin"
cordova-plugin-device 2.0.3 "Device"
cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 4.1.2 "cordova-plugin-ionic-webview"
cordova-plugin-mauron85-background-geolocation 3.0.0-alpha.50 "CDVBackgroundGeolocation"
cordova-plugin-sms-receive 1.0.2 "SMS Receive"
cordova-plugin-splashscreen 5.0.3 "Splashscreen"
cordova-plugin-statusbar 2.4.3 "StatusBar"
cordova-plugin-whitelist 1.3.4 "Whitelist"
cordova-plugin-x-socialsharing 5.6.0 "SocialSharing"
cordova-support-google-services 1.3.1 "cordova-support-google-services"
es6-promise-plugin 4.2.2 "Promise"
phonegap-plugin-multidex 1.0.0 "Multidex"
phonegap-plugin-push 2.3.0 "PushPlugin"

ionic info -

Ionic:

   ionic (Ionic CLI)  : 4.6.0 (C:\Users\<myuser>\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework    : ionic-angular 3.9.5
   @ionic/app-scripts : 3.2.2

Cordova:

   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : android 7.1.4
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.2, (and 10 other plugins)

System:

   NodeJS : v10.16.3 (C:\Program Files\nodejs\node.exe)
   npm    : 6.9.0
   OS     : Windows 10

I am not sure why is it happening?
Did anyone get into this problem? It looks like to be the firebase problem which i am using for push notification.

just try remove the android platform by following command

ionic cordova platform remove android

and then Re Add it. Hope it will help.

I tried it already but no success :disappointed_relieved:

I think you should try creating a blank new ionic project, and then replace code src folder with the new one. Then try building it.

Yes i have followed the same way, and then found the cause that it is push notificaiton plugin giving the issue when installed with background-geolocation

I didn’t get this ? Do you mean my issue will get closed automatically