14

I am trying to login Facebook with Firebase. I have installed all the libraries required and completed the required configuration. Still, whenever I try to start my app it is giving me this error:

(node:11160) UnhandledPromiseRejectionWarning: TypeError: Cannot read 
property 'manifest' of undefined

at removeOldOptions (C:\Users\Dell\Desktop\firebaseapp\plugins\cordova- universal-links-plugin\hooks\lib\android\manifestWriter.js:48:32)ished in 37.33 s
at Object.writePreferences 

(C:\Users\Dell\Desktop\firebaseapp\plugins\cordova-universal-links- 
 plugin\hooks\lib\android\manifestWriter.js:27:19)
at activateUniversalLinksInAndroid 

(C:\Users\Dell\Desktop\firebaseapp\plugins\cordova-universal-links-plugin\hooks\afterPrepareHook.js:65:25)
at C:\Users\Dell\Desktop\firebaseapp\plugins\cordova-universal-links-plugin\hooks\afterPrepareHook.js:45:11
at Array.forEach (<anonymous>)
at run (C:\Users\Dell\Desktop\firebaseapp\plugins\cordova-universal-links-plugin\hooks\afterPrepareHook.js:41:17)
at module.exports (C:\Users\Dell\Desktop\firebaseapp\plugins\cordova-universal-links-plugin\hooks\afterPrepareHook.js:18:3)
at runScriptViaModuleLoader (C:\Users\Dell\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\hooks\HooksRunner.js:188:18)
at runScript (C:\Users\Dell\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\hooks\HooksRunner.js:164:16)
(node:11160) 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)
Dan
  • 59,490
  • 13
  • 101
  • 110
Eddy
  • 361
  • 2
  • 4
  • 12

3 Answers3

34

Able to solve this with below changes :

Just go to the below file in Ionic

plugins/cordova-universal-links-plugin/hooks/lib/android/manifestWriter.js

I fixed issue by changing pathToManifest as below:

var pathToManifest = path.join(cordovaContext.opts.projectRoot, 'platforms', 'android', 'cordovaLib', 'AndroidManifest.xml');

to

var pathToManifest = path.join( cordovaContext.opts.projectRoot, 'platforms', 'android', 'app', 'src', 'main', 'AndroidManifest.xml');

Anand_5050
  • 1,019
  • 2
  • 10
  • 23
8

For anyone that's looking into this these days, the actual fix for this was published by someone which you can pull in as a cordova plugin https://github.com/nordnet/cordova-universal-links-plugin/issues/133#issuecomment-369260863

@okaufmann you can use the changed version of the plugin. since it's not merged in the nordnet repository, you must remove the plugin and install again using: cordova plugin add https://github.com/walteram/cordova-universal-links-plugin

After doing...

cordova plugin rm cordova-universal-links-plugin
cordova plugin add https://github.com/walteram/cordova-universal-links-plugin

.. my project was able to build successfully.

Donovan
  • 906
  • 2
  • 11
  • 17
1

You need to update the AndroidManifest path in the plugin, which seems to be outdated. Check out this:

https://github.com/nordnet/cordova-universal-links-plugin/issues/146

Blasco
  • 1,607
  • 16
  • 30