无法读取Ionic中未定义错误的属性“清单”

Edd*_*ddy 6 cordova firebase ionic-framework firebase-realtime-database ionic3

我正在尝试使用Firebase登录Facebook。我已经安装了所需的所有库并完成了所需的配置。尽管如此,每当我尝试启动我的应用程序时,都会出现此错误:

(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)
Run Code Online (Sandbox Code Playgroud)

Ana*_*050 6

可以通过以下更改来解决此问题:

只需在Ionic中转到以下文件

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

我通过更改pathToManifest来解决问题,如下所示:

var pathToManifest = path.join(cordovaContext.opts.projectRoot, 'platforms', 'android', 'cordovaLib', 'AndroidManifest.xml');
Run Code Online (Sandbox Code Playgroud)

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

  • 谢谢,我刚刚在 React JS + Cordova 应用程序中使用了你的修复,也有效! (2认同)

Don*_*van 5

对于最近正在研究这个问题的任何人来说,对此的实际修复是由某人发布的,您可以将其作为cordova插件引入https://github.com/nordnet/cordova-universal-links-plugin/issues/133#issuecomment -369260863

@okaufmann 您可以使用插件的更改版本。由于它未合并到 nordnet 存储库中,因此您必须删除该插件并使用以下命令重新安装:cordova plugin add https://github.com/walteram/cordova-universal-links-plugin

做完...

cordova plugin rm cordova-universal-links-plugin
cordova plugin add https://github.com/walteram/cordova-universal-links-plugin
Run Code Online (Sandbox Code Playgroud)

..我的项目能够成功构建。


Bla*_*sco 1

您需要更新插件中的AndroidManifest路径,该路径似乎已过时。看看这个:

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