Ionic Cordova app stopped compiling after Google's June 17th Firebase SDK update
This build failure is due to a major version release of the Google Play Services and Firebase libaries on June 17.
The new library versions have the following requirements:
- Upgrade
com.android.tools.build:gradle
to v3.2.1 or later.- Upgrade
compileSdkVersion
to 28 or later.- Update your app to use Jetpack (AndroidX)
The first two requirements can be resolved by updating to use cordova-android@8.0.0
.
The third requires that your Android project migrates to using AndroidX (Jetpack).
AndroidX is the successor to the widely-used Android Support Library.
AndroidX now used by the latest versions of Play Services/Firebase libraries and the Support library is used by many existing plugins such as cordova-plugin-firebase.
The two libraries cannot live side-by-side in the same Android build - doing so will lead to build failure.
To resolve this issue, add the following two plugins your Cordova project:
- cordova-plugin-androidx to enable AndroidX in the Android project.
- cordova-plugin-androidx-adapter to dynamically patch the source code of any plugins using the Support Library to use the AndroidX equivalents.
For a working example of how to try this out in a test project, see my comment on this Github issue.
Note: if you are using cordova-plugin-firebase and encountering errors, you can instead use my fork of that plugin which is published as cordova-plugin-firebasex
and is fixed to resolve issues caused by the new Firebase SDK:
rm -Rf platforms/android
cordova plugin rm cordova-plugin-firebase
rm -Rf plugins/ node_modules/
npm install
cordova plugin add cordova-plugin-firebasex
cordova platform add android
Problem updating to android 7.0.0 on cordova project: Failed to execute aapt
Finally, following this answer got it to work.
Additionally, I had to upgrade (remove and add again) cordova-plugin-compat@1.2.0
And finally got the cordova build android
to work.
However, when trying to compile the java code along with code in www folder, I have problems with some imports on .java classes. That's for another question though.
Following the answer quoted, I got the apk running
Cordova stopped building after the 23rd April 2020 Firebase update
While it's a bit of trial and error with the versioning, the following combination of plugins has solved the problem by locking to a specific version for all other plugins that depend on google/firebase services:
- cordova-android-play-services-gradle-release: https://github.com/dpa99c/cordova-android-play-services-gradle-release (was already installed)
- cordova-android-firebase-gradle-release: https://github.com/dpa99c/cordova-android-firebase-gradle-release (was NOT installed)
- cordova-plugin-firebase-lib: https://github.com/wizpanda/cordova-plugin-firebase-lib (was already installed)
processDebugResources Error appears while building an android application using Ionic 3
Problem solved, when I added all three plugins.
cordova-plugin-firebasex
cordova-plugin-androidx
cordova-plugin-androidx-adapter
Thanks to comment:
https://github.com/arnesson/cordova-plugin-firebase/issues/1081#issuecomment-503135862
My current configuration:
ionic info
Ionic:
Ionic CLI : 5.0.3 (C:\Users\volkk\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.2.4
Cordova:
Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : android 8.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.2, (and 19 other plugins)
Utility:
cordova-res : 0.3.0
native-run : not installed
System:
Android SDK Tools : 26.1.1 (C:\android)
NodeJS : v10.15.1 (C:\Program Files\nodejs\node.exe)
npm : 6.9.0
OS : Windows 10
ionic cordova plugins list
> cordova.cmd plugin ls
com-sarriaroman-photoviewer 1.1.18 "PhotoViewer"
cordova-background-geolocation 2.12.3-beta.1 "BackgroundGeolocation"
cordova-plugin-androidx 1.0.2 "cordova-plugin-androidx"
cordova-plugin-androidx-adapter 1.1.0 "cordova-plugin-androidx-adapter"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-background-fetch 5.4.1 "CDVBackgroundFetch"
cordova-plugin-camera 4.0.3 "Camera"
cordova-plugin-cocoapod-supportx 1.6.1 "Cordova CocoaPods Dependency Support"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-dialogs 2.0.1 "Notification"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-file-transfer 1.7.1 "File Transfer"
cordova-plugin-filepath 1.5.5 "cordova-plugin-filepath"
cordova-plugin-firebasex 2.1.0 "Google Firebase Plugin"
cordova-plugin-insomnia 4.3.0 "Insomnia (prevent screen sleep)"
cordova-plugin-ionic-keyboard 2.1.2 "cordova-plugin-ionic-keyboard"
cordova-plugin-qrscanner 3.0.1 "QRScanner"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-sqlite-storage 3.2.0 "Cordova sqlite storage plugin - cordova-sqlite-storage plugin version"
Cordova Execution failed for task ':app:transformClassesWithDexBuilderForDebug'
I had the same issue and fixed it by editing platforms/android/project.properties
Change
cordova.system.library.16=com.google.android.gms:play-services-base:11.0.4
cordova.system.library.17=com.google.android.gms:play-services-ads:11.0.4
To
cordova.system.library.16=com.google.android.gms:play-services-base:+
cordova.system.library.17=com.google.android.gms:play-services-ads:+
Related Topics
To Run Dex in Process, The Gradle Daemon Needs a Larger Heap. It Currently Has Approximately 910 Mb
Dialogfragment.Getdialog Returns Null
How to Run The Same Asynctask More Than Once
Change Edittext Password Mask Character to Asterisk (*)
Set Textcursordrawable Programmatically
Calling a Activity Method from Broadcastreceiver in Android
Sqlite Insert into Table Select * From
Music Player Control in Notification
Android Convert Px to Dp (Video Aspect Ratio)
Show Popup Above Map Marker in Mapview
Android Device Monitor "Data" Folder Is Empty
Upload Photo Using Httppost Multipartentitybuilder
Android Intercept Recent Apps Button
Retrofit and Get Using Parameters
Access The Sim Card with an Android Application