ionic-team / capacitor

Build cross-platform Native Progressive Web Apps for iOS, Android, and the Web ⚡️
https://capacitorjs.com
MIT License
12.14k stars 1.01k forks source link

Firebase-Messaging added to Android manifest, breaks build #1336

Closed vance closed 5 years ago

vance commented 5 years ago

Description of the problem:

Absolutely, 100% no firebase in our src config.xml, plugins.xml, or any of our package.json or dependencies. I do find a reference in Capacitor's AndroidManifest in https://github.com/ionic-team/capacitor/tree/master/android/capacitor/src/main

When I build with android studio, I get

Could not resolve com.google.firebase:firebase-iid:[17.0.4] 

in the generated app.iml:

<orderEntry type="library" name="Gradle: com.google.firebase:firebase-messaging:17.3.4@aar" level="project" />

in the generated gradle deps:

implementation 'com.google.firebase:firebase-messaging:17.1.0'`

Notice the two versions don't match... any way to remove firebase?

Affected platform

OS of the development machine

Other information:

Capacitor version: 1.0.0-beta.17 node version: 10.12.0 npm version: 6.4.1 CocoaPods version:

Steps to reproduce:

npx cap add android ng build --project foo --configuration=myenv cap.copy

jcesarmobile commented 5 years ago

Is it a new project or old project you updated?

vance commented 5 years ago

It's a new ionic 4 project, with a few other unrelated plugins related to Auth0 cordova. Searching for firebase in node modules even turns up nothing except the capacitor reference. When I do ionic cordova remove firebase-messaging, it says the plugin is not installed.d

vance commented 5 years ago

This is the build error

ERROR: Unable to resolve dependency for ':capacitor-android@debugUnitTest/compileClasspath': Could not resolve com.google.firebase:firebase-iid:[17.0.4].
Show Details
Affected Modules: capacitor-android
jcesarmobile commented 5 years ago

Firebase messaging is used by capacitor for push notifications. The I’ve seen the firebase-iid error sometimes when using an old 'com.google.gms:google-services'. That’s why I was asking if it was an old project. Is there a chance that one of the Cordova plugins is setting the version to something older than classpath 'com.google.gms:google-services:4.2.0'?

vance commented 5 years ago

I scoured the project for google-services google and firebase, including node_modules I have found no references at all. In fact, the gradle still says

    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'
        classpath 'com.google.gms:google-services:4.2.0'

I don't see any plugins that might be the culprit. image

jcesarmobile commented 5 years ago

Can you provide a sample project or the list of plugins you are using?

vance commented 5 years ago

These are the plugins. I can't imagine any of these would break google-services.

 <plugin name="cordova-plugin-whitelist" spec="1.3.3" />
    <plugin name="cordova-plugin-statusbar" spec="2.4.2" />
    <plugin name="cordova-plugin-device" spec="2.0.2" />
    <plugin name="cordova-plugin-splashscreen" spec="5.0.2" />
    <plugin name="cordova-plugin-ionic-keyboard" spec="^2.0.5" />
    <plugin name="cordova-sqlite-storage" spec="3.0.0" />
    <plugin name="cordova-plugin-nativestorage" spec="2.3.2" />
    <plugin name="cordova-plugin-inappbrowser" spec="3.0.0" />
    <plugin name="cordova-plugin-safariviewcontroller" spec="1.5.4" />
    <plugin name="cordova-plugin-customurlscheme" spec="4.3.0" />
    <plugin name="cordova-plugin-console" spec="1.1.0" />
vance commented 5 years ago

Could it have to do with this?


WARNING: API 'variantOutput.getPackageLibrary()' is obsolete and has been replaced with 'variant.getPackageLibraryProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variantOutput.getPackageLibrary(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.
Affected Modules: capacitor-android
vance commented 5 years ago

I tried removing all plugins, cleaning, preparing and building fresh. Still get the error. I''m using Android Studio 3.3.2. I also tried changing all versions to 17.01 or 17.4.0 in all my gradle files... no luck

mlynch commented 5 years ago

Did you try invalidating caches and restarting in Android Studio?

vance commented 5 years ago

Yes, built a brand new android project with capacitor (cleaned also), still have the problem.

vance commented 5 years ago

The only way I've gotten it to work is in the latest android studio, it has the option to click the dependency manager on the error output. After I choose version 18 from the dropdown, gradle completes sync.

I just don't understand why I even get the firebase dependency if I don't use push notification.

jcesarmobile commented 5 years ago

As far as I know, we can't make the firebase-messaging dependency optional, and it's needed for push notifications, so, as long as the push plugin is integrated in Capacitor, it will be added to your project whether you use it or not.

As I couldn't reproduce, you said you've solved your issue it by updating the dependency to 18 and latest version of capacitor ships with version 18, I'm going to close.

ionitron-bot[bot] commented 1 year ago

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.