Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot read property 'manifest' of undefined Error in Ionic

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)
like image 777
Eddy Avatar asked Aug 06 '18 10:08

Eddy


2 Answers

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');

like image 184
Anand_5050 Avatar answered Sep 16 '22 12:09

Anand_5050


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.

like image 26
Donovan Avatar answered Sep 16 '22 12:09

Donovan