Add SQLite Plugin to Phonegap 3.0 from commandline - ios

I am using Phonegap 3.0 for my latest project. I tried to add the native sqlite database plugin to prepopulate data from an existing database. The issue is i could install the plugin through commandline . It showed the following error:
#phonegap local plugin add https://github.com/jarlehansen/PhoneGap-SQLitePlugin-iOS.git
adding the plugin:
https://github.com/jarlehansen/PhoneGap-SQLitePlugin-iOS.git
fs.js:427 return binding.open(pathModule._makeLong(path),
stringToFlags(flags), mode);
^ Error: ENOENT, no such file or directory '/var/folders/7j/1qkbsztx3_bgtslq3pnnr9jc0000gn/T/plugman-tmp1383202788796/plugin.xml'
at Object.fs.openSync (fs.js:427:18)
at Object.fs.readFileSync (fs.js:284:15)
at Object.module.exports.parseElementtreeSync (/usr/local/lib/node_modules/phonegap/node_modules/cordova/node_modules/plugman/src/util/xml-helpers.js:119:27)
at /usr/local/lib/node_modules/phonegap/node_modules/cordova/node_modules/plugman/src/util/plugins.js:67:39
at /usr/local/lib/node_modules/phonegap/node_modules/cordova/node_modules/shelljs/shell.js:1707:7
at ChildProcess.exithandler (child_process.js:635:7)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:735:16)
at Socket.<anonymous (child_process.js:948:11)
at Socket.EventEmitter.emit (events.js:95:17)
I tried to manually install the plugin by importing the header files and main files and js file and then by adding feature to config.xml. But that also was a failure,.
Please Help me out to install this plugin in Phonegap 3.0

Within Cordova you can install the plugin from remote location like this:
cordova plugin add https://github.com/brodysoft/Cordova-SQLitePlugin.git
But I guess you need Git locally installed as a prerequisite. Not sure how the PhoneGap command looks like. Credits go to here.

First thing that comes to my mind when there is no such file or directory is that the directory doesn't exist because whatever tried to create it did not have proper permissions.
Try checking the permissions (this may just be a matter of running it with 'sudo')

It's a longshot, but i found that sometimes the install worked only when i used the cordova command line. download its bin and try the following:
cordova install --platform <android/ios> --project <project dir> --plugin <plugin's git>

I got is solution by using this plugin https://github.com/lite4cordova/Cordova-SQLitePlugin
which offers adding though Cordova CLI commands.

Related

"GoogleSignIn/GoogleSignIn.h" file not found

I am using Ionic with the google Plus cordova plugin: https://ionicframework.com/docs/v3/native/google-plus/
I set up everything correctly and it works without any problems on Android.
On iOS I used the command "Ionic cordova prepare iOS", at first I got problems with some Cocoapods ("cannot run cocoapods as root"), I fixed that Error with the help of this post: Can't run sudo pod install after updating to cocoapods 0.32.1 with error "You cannot run CocoaPods as root. (CLAide::Help)". After that I was able to get a .xcodeproj.
After some research I found out I have to open the .xcworkspace.
I clicked on run and got the Error: "GoogleSignIn/GoogleSignIn.h" file not found
Uninstall plugin : cordova plugin rm cordova-plugin-googleplus
Install plugin version 7.0.1: cordova plugin add cordova-plugin-googleplus#7.0.1
This will fix your problem reason being version 7.0.1 doesn't use POD dependencies.
Solution: downgrade cordova-plugin-googleplus to version 7.0.2
If you are using Firebase make sure that your podfile is not written GoogleUtilities, if so delete it, and leave only GooglePlus. Then give
pod install
to the root of your project and that's it.
Accepted the answer from ch3t. However on installing you need to supply the app specific variables as seen below. For reference visit the link https://github.com/EddyVerbruggen/cordova-plugin-googleplus/blob/master/README.md#4-installation-phonegap-cli--cordova-cli
cordova plugin add cordova-plugin-googleplus#7.0.2 --save --variable REVERSED_CLIENT_ID=myreversedclientid --variable WEB_APPLICATION_CLIENT_ID=mywebapplicationclientid
I had encountered with the same problem and solved it by this:
Copy ios/RNGoogleSignin into Libraries folder in Xcode
Add this line to Framework Search Paths in Build Settings:
$(PROJECT_DIR)/GoogleSDK
Remove libRNGoogleSign.a from Link Binary With Libraries in Build
Phases:
And lastly clean your build folder and build.
Credits to: taingmeng
I used an old mac, that was the problem

Install PushWoosh on iOS (PhoneGap/Cordova)

I'm trying to install PushWoosh, but I don't understand the first instruction here:
https://www.pushwoosh.com/programming-push-notification/ios/ios-additional-platforms/push-notification-sdk-integration-for-phonegap/
Install the Plugin source code for Phonegap push notifications into your app by running the following command in the command line:
phonegap plugin add
https://github.com/Pushwoosh/pushwoosh-phonegap-3.0-plugin.git
I tried that (copy and pasted it into terminal) and it gave me an error: [error] project directory could not be found
if you are using cordova, just use this other command (as with other cordova plugins):
cordova plugin add https://github.com/Pushwoosh/pushwoosh-phonegap-3.0-plugin.git

Phonegap 3.3.0 cannot add any plugin

I am trying to add barcodescanner plugin to an Phonegap 3.3.0 project.
Steps to reproduce:
$ cordova create app de.app.name "app-name"
$ cd app
$ cordova platform add ios
$ cordova plugin add com.phonegap.plugins.barcodescanner
Fetching plugin from "com.phonegap.plugins.barcodescanner"...
Starting installation of "com.phonegap.plugins.barcodescanner" for ios
Error during processing of action! Attempting to revert...
/usr/local/lib/node_modules/cordova/node_modules/q/q.js:126
throw e;
^
Error: Uh oh!
cannot find "/path/app/plugins/com.phonegap.plugins.barcodescanner/src/ios/CDVBarcodeScanner.mm" ios <source-file>
at module.exports.source-file.install (/usr/local/lib/node_modules/cordova/node_modules/plugman/src/platforms/ios.js:44:48)
at Object.ActionStack.process (/usr/local/lib/node_modules/cordova/node_modules/plugman/src/util/action-stack.js:46:25)
at handleInstall (/usr/local/lib/node_modules/cordova/node_modules/plugman/src/install.js:380:20)
at /usr/local/lib/node_modules/cordova/node_modules/plugman/src/install.js:331:20
at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/plugman/node_modules/q/q.js:798:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/plugman/node_modules/q/q.js:827:30)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/plugman/node_modules/q/q.js:760:13)
at /usr/local/lib/node_modules/cordova/node_modules/plugman/node_modules/q/q.js:574:44
at flush (/usr/local/lib/node_modules/cordova/node_modules/plugman/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:415:13)
If I use the github link I get the same error in short:
$ cordova plugin add https://github.com/phonegap-build/BarcodeScanner
Fetching plugin from "https://github.com/phonegap-build/BarcodeScanner"...
Starting installation of "com.phonegap.plugins.barcodescanner" for ios
Preparing ios project
/usr/local/lib/node_modules/cordova/node_modules/q/q.js:126
throw e;
^
SyntaxError: Unexpected token
Also I get the same for the original version of the plugin:
$ cordova plugin add https://github.com/wildabeast/BarcodeScanner
I found a thread about a problem in phonegap 3.0.0 but https://github.com/jonathannaguin/BarcodeScanner still gives me the same error.
I guess the importen part is cannot find "/path/app/plugins/com.phonegap.plugins.barcodescanner/src/ios/CDVBarcodeScanner.mm" ios. Any thoughts how I can dig deeper into this and make it work?
Update
I got the same problem with org.apache.cordova.console. Also if I use phonegap local plugin add ....
I notice that www/config.xml and platforms/ios/www/config.xml are broken. There is some binary empty space at the end of the file that can be removed. There might be something messed up with phonegap itself.
Problem is caused by the directory I am in. If I do cd ~ and run the same command it just works!
I was in \Volumes/www with is a samba share mounted over smbfs.

cordova console log can not be installed

I am trying to install the cordova console.log plugin.
when i am trying to install it using the command line using:
cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-console.git
I am running it from the path of the root application path
the structure of the folder is:
projName
|-- --project
|-- projName
|-- cordova
|-- CordovaLib
|-- projName.xcodeproj
|-- plugin
And the error i receive in the command line is
[Error: Current working directory is not a Cordova-based project.]
i should mention that i build the cordova project manually using imports of the frameworks because in the xcode new project window there was not Cordova/Phonegap new project option.
I am using xCode 5.0.1 and cordova 3.1.0
The error you get is self-explanatory, it is because you have not created a cordova project as it must be created. Keep reading to solve the problem.
Cordova basic project preparation steps
Based on my comment and your answer, you should follow the cordova workflow for creating projects using the CLI (command line interface), it is strongly recommended to avoid unnecessary problems, and the steps are not hard to follow.
Please follow the steps described here (official doc), read it fully, it will save you more time later if you read it:
http://cordova.apache.org/docs/en/3.2.0/guide_cli_index.md.html#The%20Command-Line%20Interface
In brief the steps are:
Install node.js
Install cordova using npm
Create a cordova project / app using the CLI
Add the desired platform to the project (android, ios, etc, as needed)
Work on your project
Add cordova plugins as necessary (for example if you need notifications add the notificacion plugin)
Build the project
Test of device or emulator (in your case iPhone, iPad simulator)
iOS Platform Guide
Also check the iOS Platform Guide completely, it is very helpful, explain additional instructions to prepare and work with XCode.
http://cordova.apache.org/docs/en/3.2.0/guide_platforms_ios_index.md.html#iOS%20Platform%20Guide
Plugins
For each plugin in the API reference you will find instructions to install them using the CLI, as well as to "uninstall" them.
Only install the plugins you will need
Just for reference, the code to install notifications-dialogs plugin using the terminal (run the command inside your project folder):
$ cordova plugin rm org.apache.cordova.dialogs
On the other hand, the easier way to solve the problem is create the new project following the noted steps and later just add your existing code or files to the proper folders, as well as add the required plugins, not that difficult.

Error in installing plugin for Phonegap 3.1 (iOS)

I am trying to create a new project, following:
$ phonegap create test com.temp testX
$ cd test
$ phonegap build ios
$ phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git
The plugin (device) is successfully downloaded to test/plugins/, but not successfully install to test/platforms/ios/testX/Plugins/. Opening the project in Xcode will show those files are missing. Manually copy and reference them won't completely fix it.
What is the cause of this?
PS: It works if I dont specify the project's name:
//project name will be HelloWorld.xcodeproj
$ phonegap create test
Add the plugin before you build iOS by switching the order of your last 2 commands
Hi "git" is also a node module. Simplest way want i found is.
npm install -g git
This will install git in you node source location as a module.
Restart the machine.
Install phonegap plugin:
C:\Users\user1\yourprojectname>cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-camera.git
You will get response as:
Fetching plugin from "https://git-wip-us.apache.org/repos/asf/cordova-plugin-cam
era.git"...
Starting installation of "org.apache.cordova.camera" for android
Preparing android project
org.apache.cordova.camera installed on android.
Hope this will be very helpful. If any issue reply.

Resources