IONIC build error after installing plugin

Hi,

My build was working before executing these scripts in my Ionic 3 project.

ionic cordova plugin add cordova-plugin-firebase
npm install --save @ionic-native/firebase
PS C:\Projects\App> ionic cordova build android
Running app-scripts build: --platform android --target cordova
[12:45:41]  build dev started ...
[12:45:41]  clean started ...
[12:45:41]  clean finished in 4 ms
[12:45:41]  copy started ...
[12:45:41]  deeplinks started ...
[12:45:41]  deeplinks finished in 54 ms
[12:45:41]  transpile started ...
[12:45:43]  transpile finished in 2.48 s
[12:45:43]  preprocess started ...
[12:45:43]  preprocess finished in less than 1 ms
[12:45:43]  webpack started ...
[12:45:44]  copy finished in 2.63 s
[12:45:48]  webpack finished in 4.80 s
[12:45:48]  sass started ...
Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.
[12:45:49]  sass finished in 578 ms
[12:45:49]  postprocess started ...
[12:45:49]  postprocess finished in 5 ms
[12:45:49]  lint started ...
[12:45:49]  build dev finished in 7.99 s
> cordova build android
Android Studio project detected

Preparing Firebase on Android
ANDROID_HOME=C:\Users\alber\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_172
studio
Subproject Path: CordovaLib
Subproject Path: app
[12:45:51]  tslint: C:/Projects/App/src/app/app.component.ts, line: 38
            Property 'toastCtrl' is declared but its value is never read.

      L37:  private loadingCtrl: LoadingController,
      L38:  private toastCtrl: ToastController,
      L39:  private fcm: FcmProvider

[12:45:51]  tslint: C:/Projects/App/src/app/app.component.ts, line: 21
            All imports are unused.

      L20:  import { FcmProvider } from '../providers/fcm/fcm';
      L21:  import { tap } from 'rxjs/operators';

[12:45:51]  lint finished in 2.21 s
publishNonDefault is deprecated and has no effect anymore. All variants are now published.

Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
        at build_9x3nsm3ddvtnr7pxzw86fhs8z.run(C:\Projects\App\platforms\android\app\build.gradle:144)
:CordovaLib:preBuild
 UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:compileDebugAidl UP-TO-DATE

:CordovaLib:compileDebugRenderscript UP-TO-DATE
:CordovaLib:checkDebugManifest UP-TO-DATE
:CordovaLib:generateDebugBuildConfig UP-TO-DATE
:CordovaLib:prepareLintJar

UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources UP-TO-DATE
:CordovaLib:platformAttrExtractor UP-TO-DATE
:CordovaLib:processDebugManifest UP-TO-DATE
:CordovaLib:processDebugResources UP-TO-DATE
:CordovaLib:generateDebugSources
 UP-TO-DATE
:CordovaLib:javaPreCompileDebug UP-TO-DATE
:CordovaLib:compileDebugJavaWithJavac

UP-TO-DATE
:CordovaLib:processDebugJavaRes NO-SOURCE
:CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug UP-TO-DATE
:app:preBuild UP-TO-DATE
:app:preDebugBuild

UP-TO-DATE
:app:compileDebugAidl
 UP-TO-DATE

:CordovaLib:packageDebugRenderscript NO-SOURCE
:app:compileDebugRenderscript
 UP-TO-DATE
:app:checkDebugManifest UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:prepareLintJar UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources
 UP-TO-DATE
:app:createDebugCompatibleScreenManifests UP-TO-DATE
:app:processDebugManifest
C:\Projects\App\platforms\android\app\src\main\AndroidManifest.xml:28:13-35 Error:


See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.

:app:processDebugManifest FAILED

        Attribute meta-data#android.support.VERSION@value value=(25.4.0) from [com.android.support:appcompat-v7:25.4.0] AndroidManifest.xml:28:13-35
        is also present at [com.android.support:support-v4:26.1.0] AndroidManifest.xml:28:13-35 value=(26.1.0).
        Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:26:9-28:38 to override.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(25.4.0) from [com.android.support:appcompat-v7:25.4.0] AndroidManifest.xml:28:13-35
        is also present at [com.android.support:support-v4:26.1.0] AndroidManifest.xml:28:13-35 value=(26.1.0).
        Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:26:9-28:38 to override.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
23 actionable tasks: 1 executed, 22 up-to-date

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

BUILD FAILED in 3s
(node:353776) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with exit code 1 Error output:
C:\Projects\App\platforms\android\app\src\main\AndroidManifest.xml:28:13-35 Error:
        Attribute meta-data#android.support.VERSION@value value=(25.4.0) from [com.android.support:appcompat-v7:25.4.0] AndroidManifest.xml:28:13-35
        is also present at [com.android.support:support-v4:26.1.0] AndroidManifest.xml:28:13-35 value=(26.1.0).
        Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:26:9-28:38 to override.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(25.4.0) from [com.android.support:appcompat-v7:25.4.0] AndroidManifest.xml:28:13-35
        is also present at [com.android.support:support-v4:26.1.0] AndroidManifest.xml:28:13-35 value=(26.1.0).
        Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:26:9-28:38 to override.

* 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 3s
    at ChildProcess.whenDone (C:\Projects\App\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
(node:353776) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:353776) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

This is my package.json

{
  "name": "app",
  "version": "0.0.1",
  "author": "[REMOVED]",
  "homepage": "[REMOVED]",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/animations": "5.2.10",
    "@angular/common": "5.2.10",
    "@angular/compiler": "5.2.10",
    "@angular/compiler-cli": "5.2.10",
    "@angular/core": "5.2.10",
    "@angular/forms": "5.2.10",
    "@angular/http": "5.2.10",
    "@angular/platform-browser": "5.2.10",
    "@angular/platform-browser-dynamic": "5.2.10",
    "@ionic-native/camera": "^4.7.0",
    "@ionic-native/core": "4.7.0",
    "@ionic-native/file": "^4.7.0",
    "@ionic-native/file-path": "^4.7.0",
    "@ionic-native/file-transfer": "^4.7.0",
    "@ionic-native/firebase": "^4.7.0",
    "@ionic-native/splash-screen": "4.7.0",
    "@ionic-native/status-bar": "4.7.0",
    "@ionic-native/transfer": "^3.14.0",
    "@ionic/pro": "1.0.20",
    "@ionic/storage": "2.1.3",
    "angularfire2": "^5.0.0-rc.6.0",
    "cordova-android": "7.0.0",
    "cordova-ios": "4.5.4",
    "cordova-plugin-camera": "^4.0.3",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-file": "^6.0.1",
    "cordova-plugin-file-transfer": "^1.7.1",
    "cordova-plugin-filepath": "^1.3.0",
    "cordova-plugin-firebase": "^1.0.5",
    "cordova-plugin-ionic-keyboard": "^2.0.5",
    "cordova-plugin-ionic-webview": "^1.1.19",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "firebase": "4.12.1",
    "ionic-angular": "3.9.2",
    "ionic-img-viewer": "^2.9.0",
    "ionicons": "3.0.0",
    "ngx-moment": "^2.0.0",
    "rxjs": "5.5.10",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "3.1.9",
    "typescript": "~2.6.2"
  },
  "cordova": {
    "plugins": {
      "cordova-plugin-whitelist": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {},
      "cordova-plugin-ionic-keyboard": {},
      "cordova-plugin-file-transfer": {},
      "cordova-plugin-camera": {},
      "cordova-plugin-file": {},
      "cordova-plugin-filepath": {},
      "cordova-plugin-firebase": {}
    },
    "platforms": [
      "ios",
      "android"
    ]
  }
}

Iā€™ve been here and tried the suggested solution already but didnā€™t work.

Have you even tried ; Suggestion: add ā€˜tools:replace=ā€œandroid:valueā€ā€™ to element at AndroidManifest.xml:26:9-28:38 to override.

That androidmanifest is generated by the build scripts, I canā€™t manual change that.

Okay, so I installed a fresh tabs starter project and installen the firebase plugin and the android platform.
The build was working after then so that means any other plugin that Iā€™ve installed in my project caused the problems.

So I had 4 plugins that are not in the starter project:

  1. cordova-plugin-file-transfer
  2. cordova-plugin-filepath
  3. cordova-plugin-camera
  4. cordova-plugin-file

I removed all plugins and installed 1 by 1 and after every install I ran the android build command.
Happens that the ā€˜cordova-plugin-filepathā€™ plugin caused the problems.

So, cordova-plugin-filepath and cordova-plugin-firebase donā€™t go together!

Lucky me I didnt need the plugin so I removed it.

1 Like