0

I have built a simple android app using Cordova which runs perfectly on a device.

I have a new requirement to alert the user on offline/online which I understand involves using the Network Information plugin (https://github.com/apache/cordova-plugin-network-information).

Trying to add a plugin to the app using the CLI, as expected, I receive the error Current working directory is not a Cordova-based project. because the project structure has changed.

How can I add this plugin into my app – manually if necessary?

I hope to not to have to resort to using eclipse again but will do if required.

Ant Swift
  • 20,089
  • 10
  • 38
  • 55
  • How did you convert it to an Android Studio project? Could you just copy the /src/ and /js/ files over? Or maybe make a new CLI project, add all of the plugins and platforms that you have, then just copy those resources into your studio project folder? – MBillau May 19 '14 at 15:51

1 Answers1

0

If you haven't created the project using 'cordova create ' from the command line, you'll have to recreate the project doing so to use the cordova plugin management.

Since I don't know the complexity of your application, I can't give you feedback on doing this.

It's best, if you want to use the cordova command line to manage plugins, to keep everything in the cordova structure in a version control system (see What parts of cordova cli generated projects can be safely versioned in source control? for more).

Community
  • 1
  • 1
mooreds
  • 4,932
  • 2
  • 32
  • 40
  • I don't mind doing away with the CLI and manually integrating the plugins from source. That said I'm looking at creating a new app wrapper. – Ant Swift May 20 '14 at 07:59
  • Ah. If you are looking to integrate the plugins from source, you probably want to get familiar with plugman: https://github.com/apache/cordova-plugman – mooreds May 20 '14 at 17:03