Ionic 2 / Cordova: Plugins Not Found - javascript

I seem to be having an issue with all Cordova plugins that I am adding to my project. For this question, I will reference specifically the SplashScreen plugin.
The process that I take when building my project for IOS is as follows:
ionic cordova platform add ios
ionoc cordova prepare ios
ionic cordova build ios
At this point, the build will fail with an error 65 on xcode args. After some googling, I found that a solution to this is to perform ionic cordova platform update ios, this fixes the problem and allows me to compile and run my application, yay!
The reason that I have included the above details is, I am worried that perhaps updating the platform is for some reason causing the plugins not to load / be included. Just a thought but thought I would include that process for reference.
When running my project in the IOS emulator on mac, I get the following plugin errors in the console for xCode, this error message is specifically for the StatusBar but is the same for all other plugins I have added:
2017-08-13 20:41:36.391 Shokuni[20906:1123728] CDVPlugin class CDVStatusBar (pluginName: statusbar) does not exist.
The plugins then reset due to page load…
2017-08-13 20:41:37.724 Shokuni[20906:1123728] Resetting plugins due to page load.
Then i get the following error about the status bar, which I assume is because it is being attempted to be used on the first page loaded in the project
2017-08-13 20:41:38.883 Shokuni[20906:1123728] CDVPlugin class CDVStatusBar (pluginName: StatusBar) does not exist.
2017-08-13 20:41:38.883 Shokuni[20906:1123728] ERROR: Plugin 'StatusBar' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
Inside xCode, in the File Explorer panel on the left, there are no plugins inside the plugin folder, I am wondering whether this could potentially be an issue? I can however see that the plugins that I have installed are available at staging/www/plugins
Anybody had this problem before or knows about what may be going on? If so I would be very grateful.

Related

ngCordova Plugins - Issue getting cordova.js included properly

I've been trying everything for the past two days to solve this issue. I'm well and truly stumped. Perhaps someone with greater knowledge than I can shed some light on the issue:
Basically, I'm building an app in AngularJS with the purpose of building Android and iOS apps from it using Cordova. I should specify that I am using cordova-cli on Linux and ngCordova (wrapper around plugins). I am NOT using Ionic Framework.
My app works fine in Chrome. I followed the ngCordova installation guide perfectly: http://ngcordova.com/docs/install/
I used bower to install. Then included the following in the index.html of my Web App project (not the Cordova project):
<script src="lib/ngCordova/dist/ng-cordova.js"></script>
It didn't work. I thought maybe it's because the ng-cordova.js went into my bower components directory. So I changed that script tag to:
bower_components/ngCordova/dist/ng-cordova.js
When I go to my cordova project directory and set up the platforms, plugins etc... and run:
cordova build android
followed by
cordova run android
The app runs on my device (Nexus 5). I use chrome://inspect to see what happens when I click the button which should be using the email composer plugin: I get a cordova not defined error.
I went into the controller and put this in
console.log($cordovaEmailComposer);
I can examine this in chrome://insepct and it has all the correct functions etc.. so ng-cordova.js is running fine (thats where the factory for the plugin is).
I'm 99% sure the issue is that somewhere along the line cordova.js is being lost. When I go into the cordova project in the ProjectName/www/index.html the tag for cordova.js is commented out.
Same in the platforms/android/assets/www/index.html file.
I traced it back and the same is true in WebAppProject/dist/index.html file. It's commented out. So it seems that when I run grunt build cordova.js is being removed. I thought maybe it's because cordova.js wasn't in the WebAppProject so I brought it into the root directory (same locations as index.html) and it still happened.
Can anyone explain how to properly get this working? I'm totally at a loss. I've tried a million different ways of including cordova.js. I even manually uncommented it out in the cordovaproject/www/index.html. The app builds but crashs upon opening (white screen then dies) suggesting a missing script (despite cordova.js being n that directory too...).
Is this the grunt build process? Or am I totally setting up an ngCordova project incorrectly without realising... I would post some code but I'm 99% sure the issue is with cordova.js or the way the project is building upon either grunt build or cordova build.
Any help would be much appreciated. :)
Cheers,
D
Make sure to include ngCordova before cordova.js and after angular.js.
<script src="/path/to/angular.js"></script>
<script src="/path/to/ng-cordova.js"></script>
<script src="/path/to/cordova.js"></script>

Two cordova-plugin-device plugins

I have just added the cordova plugin com.phonegap.plugin.mobile-accessibility to my ionic project, and it had automatically installed cordova-plugin-device as it is its dependency.
This would be fine, but I already have the plugin installed (as a dependancy of another plugin) under a different name (org.apache.cordova.device). Has anyone got any ideas on whether I should keep both, or how I could remove one.
I think that having both of these plugins is causing the following error and stopping me from building the App.
[INFO:CONSOLE(59)] "Uncaught module cordova-plugin-device.device not found", source: file:///android_asset/www/cordova.js (59)
I have screen dumped the dependency errors I get when trying to uninstall one of the plugins.
Easy enough fix, I removed the android platform and then re-added it again. As it went through the install it skipped the second cordova-plugin-device plugin install so now the platform only has it once.
The App now builds and works as it should.
Answer was found here - http://forum.ionicframework.com/t/plugins-does-not-exist/2980/5
NOTE: did not need to remove and add ionic & Cordova, only the Android and iOS platforms

Phonegap Build plugin not recognised, js not loading

I've been tasked with learning how to build Phonegap Apps through AEM 6.0. So far i managed to create an empty starting point app and get some features fro the ootb geometrixx app back in.
Now i've been trying to add the phonegap camera plugin without success.
I've added the required line to our config.xml:
<gap:plugin name="org.apache.cordova.camera" version="0.3.2" />
and to our installPlugins js that's called as a before_platforms_add cordova hook.
I've checked CLI build and the contents of the apk we're getting from phonegap build and all the files that should be present are present. However I'm still getting File Not Found errors on the js files and a Plugin Does Not Exist Cordova error.
screenshot link for browser console & file structure of apk
Googling hasn't gotten me any real pointers so far, perhaps somebody here can help me out?
After after even more searching and delving into the apk provided by Phonegap Build, a solution has turned up:
As it turns out, there was a third place where the loading of the js files was controlled, namely the contentsync-file-list.js.jsp file located in the splash page component.
Somehow, although the files were present in the phonegap builds and known to cordova, the list of a plugin's js files not being included in the contentsync-file-list.js.jsp prevents them from actually being loaded by the app.

PhoneGap App mysteriously stopped working on iOS Emulator and Device. Stripped down code, still broken

I was creating an ionicframework/cordova/phonegap app but following some updates I'm no longer able to test it on the iOS emulator or device.
I've stripped out the majority of my code just to see if I was doing something wrong. I'm unfortunately getting no error messages, and I'm wondering whether it's a problem with my environment? I'm using Mac OSX 10.9.3.
I am unable to log to the console at this point, however we do get to this line.
If you git clone this project you should be able to run npm install and then gulp emulate to see exactly what I mean - assuming no issues with the installation.
This is what I see inside the console.log produced by ionic emulate ios.
2014-06-08 13:46:00.612 Ionic App[83437:70b] Multi-tasking -> Device: YES, App: YES
2014-06-08 13:46:00.623 Ionic App[83437:70b] Unlimited access to network resources
2014-06-08 13:46:00.650 Ionic App[83437:70b] [CDVTimer][statusbar] 6.989956ms
2014-06-08 13:46:00.650 Ionic App[83437:70b] [CDVTimer][TotalPluginStartup] 7.485032ms
2014-06-08 13:46:00.781 Ionic App[83437:70b] Resetting plugins due to page load.
2014-06-08 13:46:00.932 Ionic App[83437:70b] Finished load of: file:///Users/sebinsua/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/CC48195C-28FF-4138-88C4-90E02AA044CA/Ionic%20App.app/www/index.html#/
2014-06-08 13:46:00.955 Ionic App[83437:70b] adding proxy for Contacts
2014-06-08 13:46:00.956 Ionic App[83437:70b] Ionic is ready.
I even have a repository in which I removed most of the dependencies and that's also playing up...
Does anybody know why it's not working? Can I troubleshoot my environment in anyway? I was just planning on finishing my MVP and then going ahead and rewriting it with Swift but at this point I'm wondering whether to bother. There's something really annoying with the fact it's silently failing with no error messages. I don't know what to troubleshoot. Any way of getting more errors/verbosity than I have?
The funny thing is that it's loading the template and not running the code inside the controller that's related to this.
If I just bring up a local server and use the browser then it all works?! Does that mean something is wrong with Cordova?

Cordova and Ionic: plugin not updating

I have a question concerning plugins. I am using the ionic framework (http://ionicframework.com/) and Cordova for my hybrid app. I am using
a toast (text popup) plugin to provide some feedback. Everything works but
I decided that I needed some customization so I edited some of the .java files.
It seems that my edit has no impact, it's really strange, the plugin also seems to keep
working even when I comment out the execute function.
I am using the following ionic command to test the app on my smartphone: "ionic run android"
Any idea why the plugin is not updating? Thanks in advance!
I had issues with plugins as well and decided to remove/add them back in, then update platform and it worked.
cordova plugin rm org.apache.cordova.<plugin>
cordova plugin add org.apache.cordova.<plugin>
cordova platform update <platform>
When I remove my android platform and install it back it works (it seems the only place where it installs plugins)

Categories

Resources