nordnet / cordova-universal-links-plugin

[DEPRECATED] - Cordova plugin to support Universal/Deep Links for iOS/Android.
https://github.com/nordnet/cordova-universal-links-plugin/issues/160
MIT License
349 stars 526 forks source link

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

Closed coyoteltd closed 5 years ago

coyoteltd commented 6 years ago

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.

rozhnev commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

@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 commented 5 years ago

👋 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.