Ionic 4 + Capacitor - Error while building Android app


#1

(why isn’t there an “ionic-v4” category in the forum ?)

I am building my first Ionic 4 with Capacitor app, and tried to build the Android native app. I run ionic build, followed by ionic cap sync and then ionic cap open android.
Android studio opens and loads the project, and then I get an error:

Failed to notify dependency resolution listener.
The library com.google.android.gms:play-services-basement is being requested by various other libraries at [[15.0.1,15.0.1]], but resolves to 11.6.2. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.

I am using Firebase Realtime Database, Firebase Auth and Firebase Push Notifications.

As I’m new to all this, any hints on how to fix much appreciated.

Thanks
Chris


#2

update: I tried all possible solutions I could find on the net, including removing node_modules and android folder and rerunning npm install and ionic cap add android, ionic build and ionic cap sync, but the problem still persists…

Any help?


#3

Dont think removing/adding will solves it, looks like a typical Android SDK or whatever libs conflict. Like one lib request such version and the other such version. In Cordova to try to solve the issue I would play with the project.properties file, in Capacitor I guess it’s something in the cradle configuration

For Capacitor support you could maybe have a try to post your question on the Slack channel


#4

Thanks for the suggestion. I’ll do that! Thanks :slight_smile:


#5

Are you using a bunch of plugins to do the firebase stuff or just the single firebase plugin. @ionic-native/firebase/ngx seems to be working OK for us (ionic v4) but had to wrestle it a bit initially because I also had FCM and other firebase plugins installed.


#6

There were two entries in the configuration that referred to phonegap libraries for some reason. I removed those and the project built! Many thanks !


#7

What was it that you removed, can you perhaps drop some more details as I am sitting with this exact issue now myself.

Thanks


#8

Sure.
In package.json, I removed these two lines under “dependencies”:
“phonegap-plugin-multidex”: “^1.0.0”,
“phonegap-plugin-push”: “^2.2.3”,

Hope it helps :slight_smile:


#9

That makes absolutely no sense, seeing as that was installed by the plugins the cods instruct us to install, but WTF hey, it works, shots man.