Cordova 3.4: How to Manually Install a Plugin - android

I would like to manually install this plugin into my Android application, which is built on Cordova 3.4. The plugin is compatible with Cordova up to v3.1. The plugin checks to see if geolocation via GPS is enabled on a device.
I've attempted referencing the plugin in res/xml/config.xml, however this reference is removed each time I run cordova build android. The result is that when I run the program I get a Class not found error.
Any thoughts on this particular scenario or just how to manually install a Cordova 3.4 plugin would be greatly appreciated.
Many Thanks!

Add Plugin Features
If you use a platform-specific workflow, you use a lower-level Plugman command-line interface, separately for each targeted platform.
Installing Plugman
To install plugman, you must have node installed on your machine. Then you can run the following command from anywhere in your environment to install plugman globally, so that it is available from any directory: $ npm install -g plugman
Adding a Plugin
Once you have installed Plugman and have created a Cordova project, you can start adding plugins to the platform:
Check this link : Plugman to manage Plugin
Edited : Plugman to Manage Plugins (3.4.0)

Related

Install Cordova plugin without package.json file on it

I'm trying to install a Cordova Plugin with Cordova CLI 7.
This plugin does not have a package.json file on it, so it throws an error when adding it to my project.
I've tried converting the config.xml file using plugman. And it works fine for Android but it doesn't for iOS. I feel like I'm missing some configuration from the config.xml in my package.json file.
Is there a way to safely convert the config.xml in a package.json file? or a way to install it using the config.xml file?
Thanks
Yes, since Cordova 7, the installation of platforms and plugins are by default performed using cordova-fetch which in turn uses npm install to add/remove modules. Therefore a package.json is required by default. But you should be able to add plugins lacking a package.json file by using the nofetch parameter, which forces Cordova to use the old method instead, please note that this parameter has been removed in cordova 8.0.0:
cordova plugin add cordova-plugin-camera --nofetch
For me when adding a custom plugin like so
cordova plugin add .\custom-plugins\my-plugin --nofetch
This does not work on MAC for me for some reason.
I resort to building it all for Android then copy over all the files, except node_modules and platforms, then do a 'cordova build ios' it seems to build fine with the custom plugins included. Not the best way i know, but once the plugin is added i can move on and continue. If you get it to work please share.
--nofetch option is removed in Cordova 8.0.0: https://issues.apache.org/jira/browse/CB-13055
If you have already installed Cordova 8.x.x then you can downgrade it to version 7.1.0 and then use the --nofetch option.
Run the following command to downgrade Cordova to 7.1.0:
npm install -g cordova#7.1.0
If the above command doesn't work, then try uninstalling cordova at first and then install cordova version 7.1.0:
npm uninstall -g cordova
npm install -g cordova#7.1.0
Then, check the Cordova version:
cordova --version

How to run an ionic v1 app on Android?

I just received an ionic v1 app that I have to make some changes,but after a fresh installation of ionic, I'm unable to run it. Every time that I run ionic run android in the ionic CLI, I receive this error:
WARN: ionic.project has been renamed to ionic.config.json, please
rename it. Using this version of Cordova with older version of
cordova-android is deprecated. Upgrade to cordova-android#5.0.0 or
newer.
Error: Your android platform does not have Api.js
For the moment I can not migrate to Ionic 2.
What can I do to run/build it?
Fist of all, when you install Ionic this way
npm install -g cordova ionic
You are getting the last CLI that works with Ionic 2, Angular 2 and a different project structure. If you want to run and build an Ionic v1 project you need the tools that works with your version.
To install a specific version you need to add # symbol after the name package and the version that you want for example:
npm install -g ionic#1.7.14
npm install -g cordova#6.0.0
Also you have to keep in mind that Android has been improving their tools too, and this version of cordova doesn't work properly with the latest Android tools chain. This question can help you to download and setup the android tools for this version of cordova.
After that you will be able to run ionic run android

Plugman installs to platform_www and NOT to www as it used to in Cordova 6.1

I have an app built with an older version of Cordova, 3.x . Which I now want to upgrade to Cordova 6.1 . For Android using platform specific workflow.
When I created that one, I used cordova cli first, then added plugins with plugman and kept working from that moment on, using the platform specific workflow. This is because I need to add customizations to AndroidManifest.xml, for example, and I don't find how to do it if I use the CLI.
Today I upgraded cordova, and regenerated my project from scratch. When I try to install the plugins using plugman, it installs to platform_www folder instead of www folder. Since I am using platform-specific workflow, this doesn't work. I tried using the -www parameter in plugman, but apparently that was ignored since it kept installing to platform_www folder.
This is how I tried:
plugman install --platform android --project platforms/android --plugin cordova-plugin-console --www platforms/android/assets/www
Since I didn't find a way for plugman to work as it had worked before in older versions, I tried installing cordova-android to create the project with it. So maybe then plugman will work as desired.
I did:
npm install -g cordova-android
But afterwards when I run cordova-android in the command prompt, it says command not recognized. It recognizes cordova ok, but not cordova-android.
Can anyone help me please? I need to either:
a) know if there is a way to make any customization to AndroidManifest.xml when using the CLI (and Info.plist when working on iOS)
b) know how to make plugman install the plugins to assets/www instead of platform_www folder
c) know how to make cordova-android run
I have plugman version 1.2.1 and cordova version 6.1.1, I updated both today to latest.
Thanks for any help!

Can't build app with Ionic

I am no longer able to build my app and generate an apk anymore because an error shows up. Here is what happens when I try to build the app in the command prompt: Command Prompt
Can somebody please help me with this? Oh and this is what happens if I type ionic info in the command prompt:
Your environment has been set up for using Node.js 0.12.4 (x64) and npm.
C:\Users\Singh>ionic info
Your system information:
Cordova CLI: 5.1.1
Ionic CLI Version: 1.6.1
Ionic App Lib Version: 0.3.3
OS: Windows 7 SP1
Node Version: v0.12.4
C:\Users\Singh>
Try to remove the platform, and then add it again, and then build your application.
So, if you have android as targeted platform execute these commands:
ionic platform remove android
ionic platform add android
ionic build android
My son had a very similar problem, and we never did figure out what caused it. He ended up creating a brand new blank ionic project, and then just copying the www folder from the old project. It worked, and he was able to get things building again. If you try it, you'll also have to re-add your plugins, copy package.json and bower.json, and then rerun bower install and npm install. It's not pleasant, but it might be worth a shot if you're desperate.

How to configure jenkins with titanium studio to work?

I want to develop a mobile application with titanium. Before starting I should first configure SVN and jenkins with titanium studio. I have already installed a plugin svn: subversion plugin on jenkins server plus another plugin named Eclipse plugin on titanium studio. Now I want to configure titanium with jenkins. I searched jenkins plugins available and I found a plugin called: android lint plugin.
Is what I must also install it?
Configure your repository in jenkins (SVN, git..) and install the Titanium CLI.
Add a buildstep to the Jenkins buildprocess for this project, which invokes a script in the Titanium folder. Perhaps you need to unlock your mac keychain before starting that build script, for more information have a look at http://www.egeek.me/2013/02/23/jenkins-and-xcode-user-interaction-is-not-allowed/ . If you combine the call of the build script with the unlocking, everything will run fine automatically.
The build.sh contains the call for the Titanium CLI:
titanium build --force --developer-name "YOURDEVNAME" --pp-uuid "YOURUUID" --platform ios --build-only --target device --device-family universal
This will build the project and create a .ipa in the folder build/iphone/build/Debug-iphoneos/

Categories

Resources