Skip to content
This repository has been archived by the owner on Oct 1, 2018. It is now read-only.

Edited: Cordova can't build with plugin installed and <host> specified. #146

Closed
coyoteltd opened this issue Apr 6, 2018 · 4 comments
Closed

Comments

@coyoteltd
Copy link

coyoteltd commented Apr 6, 2018

Solved it! The plugin has the old path for the AndroidManifest.xml file! It's in a different place in 8.0.0. This should probably get fixed, so I'm leaving it open so maintainers see it!

If you found this trying to solve this problem, you can set the path explicitly in plugins/cordova-universal-links-plugin/hooks/lib/android/manifestWriter.js on line 21.

Additional edit: This is apparently a duplicate of #133. . . and there's already a pull request to address it which hasn't been approved because it's not backwards compatible (so detect the version and make it backwards compatible!)

But you wouldn't KNOW that from the error / failure until you got fairly far along in your troubleshooting. So I'm leaving this here and open still in case of wayward travelers in search of quick solutions.


Edit 5: THERE IS A PROBLEM IN manifestWriter.js!
The error is [TypeError: Cannot read property 'manifest' of undefined] which is happening in the function

function removeOldOptions(manifestData) 

on line 47


After installing the plugin, my build fails at

Executing script found in plugin cordova-universal-links-plugin for hook "after_prepare": plugins/cordova-universal-links-plugin/hooks/afterPrepareHook.js

and dumps back to the command line.

Has anyone else experienced this? The only other plugins I'm using are whitelist and device. Cordova version is 8.0.0

EDIT: I'm building for Android only.

EDIT 2: Build succeeds as long as no host is specified in config.xml and complains

No host is specified in the config.xml. Universal Links plugin is not going to work.

Edit 3: Problem persists whether plugin is installed with

 cordova plugin add cordova-universal-links-plugin 

or with

 cordova plugin add https://github.com/nordnet/cordova-universal-links-plugin.git

Edit 4: Doing some troubleshooting of my own. . . the problem does not seem to be with afterPrepareHook.js. I went through and added some console.warn messages and they all executed as they should. That script is executing, but the build process is (for some reason) not continuing after.

@coyoteltd coyoteltd changed the title Adding plugin weirdly breaks Cordova. Edited: Cordova can't build with plugin installed and <host> specified. Apr 6, 2018
@rozhnev
Copy link

rozhnev commented Apr 19, 2018

I fixed issue for me by change

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

@RikdeBoer
Copy link

RikdeBoer commented Jun 1, 2018

Yep that does it for Cordova 8.0.0 Thanks coyoteltd and rozhnev!

Just to mention the file again
plugins/cordova-universal-links-plugin/hooks/lib/android/manifestWriter.js

function writePreferences(...), line 21

@rtm
Copy link

rtm commented Jun 11, 2018

@RikdeBoer I do not keep the contents of plugins (or platforms) under source control. Therefore, every time I re-clone (or my CI build job starts up) I would get the old, broken version of the plugin. Is it common practice to keep plugins and platforms under version control?

@nordnet-deprecation-bot
Copy link
Contributor

👋 Hi! Thank you for your interest in this repo.

😢 We are not using nordnet/cordova-universal-links-plugin anymore, and we lack the manpower and the experience needed to maintain it. We are aware of the inconveniece that this may cause you. Feel free to use it as is, or create your own fork.

🔒 This will now be closed & locked.

ℹ️ Please see #160 for more information.

@nordnet nordnet locked and limited conversation to collaborators Sep 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants