Two cordova-plugin-device plugins - javascript

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

Related

Error: Text data outside of root node - when installing cordova plugin

I sometimes get an error when trying to install any cordova plugin ionic (usually after around 6pm GMT+0).
These are with plugins from both npm and GitHub, and the error I get is:
Error: Text data outside of root node.
Line: 155
Column: 1
Char: "
The install command will be something along the lines of
ionic cordova plugin add cordova-plugin-network-information#1.3.1
It really does not matter what plugin it is, because as mentioned it happens for a number of them, they all get the same error. It will work perfectly ok in the morning, and then suddenly it shuts down.
I have tried on multiple computers, on multiple separate internet connections (from the UK), and I even have a script that reruns the commands if they fail, so it will attempt to install around 20 plugins continuously until they get installed for however long I run my script. I ran it for an hour constantly, and not a single one was installed.
I also checked the status of npm and GitHub if they were perhaps down, but they seemed to be up and running as usual...
Any ideas would be greatly appreciated
* Based on my comment which helped the asker, and which I was asked to publish as an answer:*
I don't know ionic at all, but I do have some experience with Cordova and never had any issues installing plugins, even on a corporate network.
Try to install the plugin without ionic.
cordova plugin add my.plugin.name
This error can be caused by an invalid AndroidManifest.xml file. After installing a plugin using ionic corvoda, my AndroidManifest.xml got a syntax error and I had this issue when building the APK.
After fixing the syntax error, the build finished successfully.

Ionic 2 / Cordova: Plugins Not Found

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.

Google Play reject Cordova application 'cause contains security vulnerabilities for users

I developed an application on Apache Cordova, I followed all the steps to generate the .apk to upload on Google Play. I tried many times but Google's response is the same:
We rejected APP, package ID com.xxx.app, for violating our dangerous products policy. If you submitted an update, the previous version of
your app is still available on Google Play. This app uses software
that contains security vulnerabilities for users. Below is the list of
vulnerabilities and the corresponding APK versions that were detected
in your recent submission. Please upgrade your app(s) as soon as
possible and increment the version number of the upgraded APK.
Vulnerability Apache Cordova: The vulnerabilities were fixed in Apache Cordova v.3.5.1.
I have the latest version of Cordova (5.4.1).
The following will detail the steps that I followed for installation and project development:
Start the download of Cordova from the console Node.js using the command npm install -g Cordova.
Install Java: version 1.8.0_65.
Install Android SDK.
Add Java and SDK to PATH.
I downloaded the necessary components of the Android SDK.
Create the project through the commands. (Cordova create Projectxxxx).
Add the Android platform.
I copied my application code in the www folder.
Add the plugins needed for my project: splashscreen and sqlite.
I tested the application on the Android emulator and other mobile phones. All good. Runs perfect.
To create the signed APK file, these are the steps:
-Cordova build --release android. (This generated the android-release-unsigned.apk on platforms / android / build / outputs
/ apk).
-Then, I generated the keystore.
-After the jarsigner.
-Finally: zipalign.
I upload end-app.apk to Google Play.
Another detail that I have is that cordova.js generated version is 4.1.1. But the console version is 5.4.1 (Command: Cordova -version).
I did everything by node.js console.
Attemps:
I uploaded an APK without js components. Only with cordova.js and it not worked.
I installed all over again in a newly installed windows and neither worked.
My version is higher than 3.5.1. I can not find the solution.
The big problem is not just that PLATFORM_VERSION_BUILD_LABEL is wrong, but the default cordova used is ancient ( it was 3.7.1 on mine ). To resolve this you need to install a newer version in the project. You can specify this on the command line, much like npm does.
cordova platform update android#4.1.1
Or you can specify it in your config.xml
<engine name="android" version="4.1.1" />
That may need 'spec' instead of 'version' depending on how current you cordova install is. At this point, they are up to 5.1, and you can use 'latest' instead of a specific version number.
The next headache will be the point of the patch, which locks down network access. I am now getting 404 errors on all my ajax calls to our server. Access was the root of the security problem, so this isn't a big surprise. I am still working on that.
I had the same problem, I found a previous corodva version in a plugin, in my case was facebook connect; I deleted this plugin and upload again, its work form me. You may search PLATFORM_VERSION_BUILD_LABEL in your project, is posible that some plugin have other cordova version.
I was trying to solve this problem almost for a week. Solution:
There was a cordova.js file within www/lib/cordova folder that doesn't get updated when you update cordova and ionic. Open the file and look for var PLATFORM_VERSION_BUILD_LABEL. If the version is not 4.1.1 at the time of this post, update it with another copy of the file that is somewhere in your main directory.

Apache Cordova Facebook Plugin BUILD FAILED

I am trying to install the facebook cordova plugin using the cordova CLI but unfortunately, whatever I do, I get BUILD FAILED whenever I try to cordova build android.
This is what I am using to install the plugin
cordova plugin add https://github.com/phonegap/phonegap-facebook-plugin --variable APP_ID="my_facebook_app_id" --variable APP_NAME="my_facebook_app_name"
Of course, I use my real facebook App_ID and App_Name. I also put them in plugin.xml everywhere there is APP_NAME or APP_ID. I don't know how to get older cmd error logs, because the only errors I see when the buld fails are error occuring because of a previous error. I tried cordova build android -d but it didn't help at all.
I don't know if it has something to do with my cordova version or with the fact that I already have other plugins and have developed quite a lot and my app is no longer as empty as the example one.
Cordova version: 3.5.0-0.2.6
P.S.: Just tried it on a new cordova build of my version, same error. I wonder how everybody else is not getting any, obviously the error is in me or the cordova version ;(

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