Ionic Android build Error: TypeError: Cannot read property 'manifest' of undefined at removeOldOptions

Hello everyone. I am new in Ionic and i am facing several issues to build an android apk in ionic 3. Tried many things and now i am stuck on this:

Android Studio project detected

(node:1176) UnhandledPromiseRejectionWarning: TypeError: Cannot read property ‘manifest’ of undefined
at removeOldOptions (C:\Users\Administrador\Documents\app\RestaurantIonic-r10\RestaurantIonic-3.0\project\plugins\cordova-universal-links-plugin\hooks\lib\android\manifestWriter.js:48:32)
at Object.writePreferences (C:\Users\Administrador\Documents\app\RestaurantIonic-r10\RestaurantIonic-3.0\project\plugins\cordova-universal-links-plugin\hooks\lib\android\manifestWriter.js:27:19)
at activateUniversalLinksInAndroid (C:\Users\Administrador\Documents\app\RestaurantIonic-r10\RestaurantIonic-3.0\project\plugins\cordova-universal-links-plugin\hooks\afterPrepareHook.js:65:25)
at C:\Users\Administrador\Documents\app\RestaurantIonic-r10\RestaurantIonic-3.0\project\plugins\cordova-universal-links-plugin\hooks\afterPrepareHook.js:45:11
at Array.forEach ()
at run (C:\Users\Administrador\Documents\app\RestaurantIonic-r10\RestaurantIonic-3.0\project\plugins\cordova-universal-links-plugin\hooks\afterPrepareHook.js:41:17)
at module.exports (C:\Users\Administrador\Documents\app\RestaurantIonic-r10\RestaurantIonic-3.0\project\plugins\cordova-universal-links-plugin\hooks\afterPrepareHook.js:18:3)
at runScriptViaModuleLoader (C:\Users\Administrador\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\hooks\HooksRunner.js:188:18)
at runScript (C:\Users\Administrador\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\hooks\HooksRunner.js:164:16)
at C:\Users\Administrador\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\hooks\HooksRunner.js:132:20
(node:1176) 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:1176) [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.

[18:33:02] tslint: …urantIonic-r10/RestaurantIonic-3.0/project/src/pages/favorites/favorites.page.ts, line: 1
‘OnInit’ is declared but never used.

   L1:  import { Component, OnInit } from '@angular/core';

[18:33:02] lint finished in 18.27 s

I would recommend searching for a replacement for this plugin, because it looks crufty and incompatibility with your cordova-android version is likely the cause of your error. If you insist on keeping it, you can try downgrading cordova-android and/or slogging through these PRs and this issue.

Hi, thanks for your reply. Do you know any other plugin to replace it?

Making this change in ‘cordova-universal-links-plugin/hooks/lib/android/manifestWriter.js’ fixed this issue for me:

https://github.com/nordnet/cordova-universal-links-plugin/issues/134#issuecomment-358398218