Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERR_INVALID_ARG_TYPE after android@7.1.2 update #554

Closed
uerceg opened this issue Nov 14, 2018 · 7 comments
Closed

ERR_INVALID_ARG_TYPE after android@7.1.2 update #554

uerceg opened this issue Nov 14, 2018 · 7 comments

Comments

@uerceg
Copy link

uerceg commented Nov 14, 2018

Hey guys.

We have our plugin built for Cordova and the version on Github master branch is compatible with pre android@7.0.0 platform version. For android@7.0.0 and above we made separate branch called cordova-8 from which people can add our plugin in case they are using those platform version(s).

Together with android@7.1.1 platform version, everything worked fine, but as of android@7.1.2, plugin can't be added on Android platform. I was trying to go through all the PRs you merged as part of android@7.1.2 update, but no luck in finding what is actually causing the error.

Error which happens once plugin is being added:

No scripts found for hook "before_plugin_add".
Calling plugman.fetch on plugin "https://github.com/adjust/cordova_sdk.git#cordova-8"
saving
Running command: npm install https://github.com/adjust/cordova_sdk.git#cordova-8 --production --save
Command finished with error code 0: npm install,https://github.com/adjust/cordova_sdk.git#cordova-8,--production,--save
Copying plugin "/Users/uerceg/Projects/Cordova/AdjustCordovaEight/node_modules/com.adjust.sdk" => "/Users/uerceg/Projects/Cordova/AdjustCordovaEight/plugins/com.adjust.sdk"
Calling plugman.install on plugin "/Users/uerceg/Projects/Cordova/AdjustCordovaEight/plugins/com.adjust.sdk" for platform "android
Installing "com.adjust.sdk" for android
Running command: /Users/uerceg/Projects/Cordova/AdjustCordovaEight/platforms/android/cordova/version
Command finished with error code 0: /Users/uerceg/Projects/Cordova/AdjustCordovaEight/platforms/android/cordova/version
Finding scripts for "before_plugin_install" hook from plugin com.adjust.sdk on android platform only.
No scripts found for hook "before_plugin_install".
Install start for "com.adjust.sdk" on android.
PlatformApi successfully found for platform android
Android Studio project detected
Beginning processing of action stack for android project...
Error during processing of action! Attempting to revert...
Failed to install 'com.adjust.sdk': TypeError [ERR_INVALID_ARG_TYPE]: Uh oh!
The "path" argument must be of type string
    at assertPath (path.js:28:11)
    at Object.resolve (path.js:1179:7)
    at copyNewFile (/Users/uerceg/Projects/Cordova/AdjustCordovaEight/platforms/android/cordova/lib/pluginHandlers.js:258:28)
    at install (/Users/uerceg/Projects/Cordova/AdjustCordovaEight/platforms/android/cordova/lib/pluginHandlers.js:43:17)
    at ActionStack.process (/Users/uerceg/Projects/Cordova/AdjustCordovaEight/platforms/android/cordova/node_modules/cordova-common/src/ActionStack.js:56:25)
    at PluginManager.doOperation (/Users/uerceg/Projects/Cordova/AdjustCordovaEight/platforms/android/cordova/node_modules/cordova-common/src/PluginManager.js:114:20)
    at PluginManager.addPlugin (/Users/uerceg/Projects/Cordova/AdjustCordovaEight/platforms/android/cordova/node_modules/cordova-common/src/PluginManager.js:144:17)
    at /Users/uerceg/Projects/Cordova/AdjustCordovaEight/platforms/android/cordova/Api.js:247:74
    at _fulfilled (/Users/uerceg/Projects/Cordova/AdjustCordovaEight/platforms/android/cordova/node_modules/q/q.js:834:54)
    at self.promiseDispatch.done (/Users/uerceg/Projects/Cordova/AdjustCordovaEight/platforms/android/cordova/node_modules/q/q.js:863:30)
Uh oh!
The "path" argument must be of type string
TypeError [ERR_INVALID_ARG_TYPE]: Uh oh!
The "path" argument must be of type string
    at assertPath (path.js:28:11)
    at Object.resolve (path.js:1179:7)
    at copyNewFile (/Users/uerceg/Projects/Cordova/AdjustCordovaEight/platforms/android/cordova/lib/pluginHandlers.js:258:28)
    at install (/Users/uerceg/Projects/Cordova/AdjustCordovaEight/platforms/android/cordova/lib/pluginHandlers.js:43:17)
    at ActionStack.process (/Users/uerceg/Projects/Cordova/AdjustCordovaEight/platforms/android/cordova/node_modules/cordova-common/src/ActionStack.js:56:25)
    at PluginManager.doOperation (/Users/uerceg/Projects/Cordova/AdjustCordovaEight/platforms/android/cordova/node_modules/cordova-common/src/PluginManager.js:114:20)
    at PluginManager.addPlugin (/Users/uerceg/Projects/Cordova/AdjustCordovaEight/platforms/android/cordova/node_modules/cordova-common/src/PluginManager.js:144:17)
    at /Users/uerceg/Projects/Cordova/AdjustCordovaEight/platforms/android/cordova/Api.js:247:74
    at _fulfilled (/Users/uerceg/Projects/Cordova/AdjustCordovaEight/platforms/android/cordova/node_modules/q/q.js:834:54)
    at self.promiseDispatch.done (/Users/uerceg/Projects/Cordova/AdjustCordovaEight/platforms/android/cordova/node_modules/q/q.js:863:30)

Steps to reproduce:

  1. Create empty new Cordova app.
  2. cordova platform add android@7.1.2
  3. cordova plugin add https://github.com/adjust/cordova_sdk.git\#cordova-8

Testing environment:

  • Mac OS X Mojave 10.14
  • Cordova version: 8.1.2 (cordova-lib@8.1.1)

Plugin code is publicly available on Github.

In case you need any additional info, please feel free to ping.

Looking forward to hear from you soon.

Cheers

@brodybits
Copy link
Contributor

Already solved in master, tested as follows:

  • cordova platform add cordova-android@nightly
  • cordova plugin add https://github.com/adjust/cordova_sdk.git\#cordova-8
  • cordova build android

Will be fixed in 7.1.3. Closing as a duplicate of GH-540.

@brodybits
Copy link
Contributor

P.S. Once PR #550 is merged and released you should not need the cordova-8 changes in adjust/cordova_sdk@114fb76 any more. Just in case you need to support cordova-android@6 (previous release) for any reason.

@janpio
Copy link
Member

janpio commented Nov 14, 2018

(FYI: Can reproduce on Windows with same Cordova CLI version)

@janpio
Copy link
Member

janpio commented Nov 14, 2018

(FYI: Can also reproduce @brodybits' temp fix via using nightly [we seem to have replied at the same time])

@janpio janpio added bug and removed support labels Nov 14, 2018
@uerceg
Copy link
Author

uerceg commented Nov 14, 2018

Awesome guys, thanks for super quick reply.

I tried @brodybits's flow with nightly build and it works like a charm. Nice. 👍

I am just not sure I understood P.S. comment. Is there a way to declare paths in plugin.xml in a way that it supports both, cordova-android@6 and cordova-android@7?

@brodybits
Copy link
Contributor

Is there a way to declare paths in plugin.xml in a way that it supports both, cordova-android@6 and cordova-android@7?

Once PR #550 is merged, it should just work if you revert adjust/cordova_sdk@114fb76.

PR #550 was raised due to the large number of plugins that were broken by the 7.0.0 release.

@uerceg
Copy link
Author

uerceg commented Nov 14, 2018

Awesome. Thank you very much, will keep an eye on 7.1.3 official release and update plugin and docs accordingly.

Cheers! 🍺

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants