Execution failed for task ':app:fabricGenerateResourcesDebug'. ionic 4

Hi everyone,
I want to create .apk file but I get this error.

BUILD FAILED in 15s
27 actionable tasks: 4 executed, 23 up-to-date
C:\Users\tagi.a\desktop\maximum-app\platforms\android\gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:fabricGenerateResourcesDebug'.
> Crashlytics Developer Tools error.

* 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

BUILD FAILED in 15s
[ERROR] An error occurred while running subprocess cordova.

        cordova.cmd build android exited with exit code 1.

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

My project.properties

target=android-28
android.library.reference.1=CordovaLib
android.library.reference.2=app
cordova.system.library.1=com.android.support:support-annotations:+
cordova.system.library.2=com.google.android.gms:play-services-base:+
cordova.system.library.3=com.google.android.gms:play-services-ads:+
cordova.gradle.include.1=cordova-plugin-firebase/news-build.gradle
cordova.system.library.4=com.google.android.gms:play-services-tagmanager:+
cordova.system.library.5=com.google.firebase:firebase-core:+
cordova.system.library.6=com.google.firebase:firebase-messaging:+
cordova.system.library.7=com.google.firebase:firebase-config:+
cordova.system.library.8=com.google.firebase:firebase-perf:+

IONIC INFO

Ionic:

   Ionic CLI                     : 5.0.2 (C:\Users\tagi.a\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.5.0
   @angular-devkit/build-angular : 0.13.9
   @angular-devkit/schematics    : 7.3.9
   @angular/cli                  : 7.3.9
   @ionic/angular-toolkit        : 1.5.1

Capacitor:

   Capacitor CLI   : not installed
   @capacitor/core : not installed

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.3, cordova-plugin-ionic-webview 4.1.0, (and 6 other plugins)

Utility:

   cordova-res : not installed
   native-run  : 0.2.6

System:

   Android SDK Tools : 26.1.1 (C:\Users\tagi.a\AppData\Local\Android\Sdk)
   NodeJS            : v10.15.3 (C:\Program Files\nodejs\node.exe)
   npm               : 6.9.0
   OS                : Windows 10

Remove cordova-plugin-firebase

download the Firebase SDK config for test project (which is required to make the build succeed)

curl https://raw.githubusercontent.com/dpa99c/cordova-plugin-firebase-test/master/www/google-services.json -o google-services.json

add the latest cordova-android platform (v8.0.0)

cordova platform add android@latest

add my fork of this plugin

cordova plugin add cordova-plugin-firebasex

add plugin to enable AndroidX in the project

cordova plugin add cordova-plugin-androidx

add plugin to patch existing plugin source that uses the Android Support Library to use AndroidX

cordova plugin add cordova-plugin-androidx-adapter

build!

cordova build android

3 Likes

I get this error now:

Failed to capture fingerprint of input files for task ':app:preDebugBuild' property 'compileManifests' during up-to-date check.
> The library com.google.android.gms:play-services-base is being requested by various other libraries at [[11.0.4,11.0.4]], but resolves to 17.0.0. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.
1 Like

Install Plugins

npm i cordova-android-firebase-gradle-release
npm i cordova-android-support-gradle-release

In package.json under plugins, you should have this:

  "cordova-android-play-services-gradle-release": {
    "PLAY_SERVICES_VERSION": "+"
  },
  "cordova-android-firebase-gradle-release": {
    "FIREBASE_VERSION": "+"
  }

In config.xml, you should have these:

<plugin name="cordova-android-play-services-gradle-release" spec="^2.0.0">
    <variable name="PLAY_SERVICES_VERSION" value="+" />
</plugin>
<plugin name="cordova-android-firebase-gradle-release" spec="^2.0.0">
    <variable name="FIREBASE_VERSION" value="+" />
</plugin>
2 Likes

Wow this worked for me after looking for solutions all day this finally worked thank you very much!!

After all the steps, I am getting this error

Execution failed for task ‘:app:transformDexArchiveWithDexMergerForDebug’.

Only solution worked for me also. I wonder about when we can use original one back. :confused: