I am trying to build phonegap app using File plugin, it works fine on local , but when building it using Phonegap build , the plugin does not work, error is
"cordova.file" is undefined
here is my config
<gap:plugin name="org.apache.cordova.file" />
I removed (verion number=1.0.1) as adviced by other questions
Also phonegap build says: "This app isn't using the latest version of PhoneGap. We recommend upgrading to 3.6.3."
Any help would be appreciated
Thanks
Look docs:
Add the following to your config.xml to use version 1.0.1 of this plugin (recommended)::
<gap:plugin name="org.apache.cordova.file" version="1.0.1" />
You can also omit the version tag to always use the most recent version of this plugin. Note that this will result in your app being automatically updated with new versions of this plugin as they are released, and may result in unexpected behaviour.
This is why you can run your app locally that not doing update automatically, however when make build, then it always try to update to the latest plugin version but your PhoneGap platform still with plugin 1.0.1 version, then undefined happen.
So to remove version tag, you should garantee your current plugin version is latest
Phonegap has problem with file plugin new features in versions later than 1.0.1
so I worked around this by including the Javascript files in the pages
thanks
Related
I know there are a number of posts on how to use the functions of the cordova inapp browser pluggin and that's great. But I am having trouble installing or including the pluggin in my app when I upload it to PhoneGap Build.
When I include:
plugin name="InAppBrowser" value="org.apache.cordova.InAppBrowser"
PhoneGap Build tells me that the pluggin is not supported...
I've also tried including the .git file but I couldn't get that working either.
Im sure im just mistyping something or missing some step. Please help!!
All I need I'm sure is the correct plugin tag to use in my config file so if someone could just paste it in this thread that would be outstanding.
So the issue I was having was because I did not install phonegap CLI before attempting to install the plugin. stupid me.... but I did it and got it working now! thanks for everyones input...
Phonegap Build has dropped support for the old method of installing plugins. You now have to use NPM as the source.
Putting this in your config.xml should make it work on Phonegap Build:
<plugin name="cordova-plugin-inappbrowser" source="npm" />
My events show up perfectly in Google Analytics when I use cordova run android with my device connected via USB. But when I install the same code on the same device (or other devices) from the Play Store, I get no events or page loads whatsoever.
I'm only working with Android right now (obviously). My config.xml was already set to <access origin="*" />, but when it didn't work I added these for (redundant?) good measure:
<access origin="http://*.google-analytics.com"/>
<access origin="https://*.google-analytics.com"/>
It didn't work with either of these states. Any idea why this might be happening?
Installed plugins:
cc.fovea.cordova.purchase 4.0.0 "Purchase"
cordova-plugin-device 1.1.0 "Device"
cordova-plugin-dialogs 1.2.0 "Notification"
cordova-plugin-file 3.0.0 "File"
cordova-plugin-google-analytics 0.8.1 "Google Universal Analytics Plugin"
cordova-plugin-splashscreen 3.0.0 "Splashscreen"
cordova-plugin-statusbar 2.0.0 "StatusBar"
cordova-plugin-whitelist 1.2.0 "Whitelist"
cordova-plugin-x-socialsharing 5.0.7 "SocialSharing"
cordova-plugin-x-toast 2.3.1 "Toast"
config.xml: http://pastebin.com/mRH2jaET
Cordova version 5.4.1
Just to clarify in case there's any ambiguity:
Everything else about my app works fine. All the other plugins work as expected, and the Google Analytics plugin works as expected when I install it locally.
I've got CSP set up in my .html files and I don't have any CSP-related errors.
#Sarah,
after review of your config.xml it is apparent you are new to Cordova/Phonegap. You are using a mix of XML components without real knowledge as to how what the mean and how they are used.
0) Phonegap Build is a cloud-based build service run by Phonegap/Adobe.
1) You have NOT use the Phonegap Build tag in your Stackoverflow post. This conflicts with your post and your config.xml.
2) You are using the gap: prefix on some of your XML components. This prefix is intended ONLY for Phonegap Build, a cloud-based service by Phonegap/Adobe.
3) You are also using xmlns:android="http://schemas.android.com/apk/res/android".
This component is intended for adding XML components to the final AndroidManifest.xml, but this is only for Phonegap Build. To my knowledge this is not supported by any other tools sets.
4) This appears to be in support of #3.
<gap:config-file platform="android" parent="/manifest">
<application android:debuggable="false" />
</gap:config-file>
However, android:debuggable="false" does NOT need to used, as all frameworks that use Cordova have a debug and release switch. This chunk of code has not been needed for over two (2) years. It is seen on some older blogs, but blogs are outdated. NOTE: any blog over 6 months old (as of today 2015-12-28) has the potentional to be outdated and wrong.
5) <feature (...) /> is ONLY used with the SDK. This is to support IDEs, hence my orignal question.
See Documentation -> The config.xml File -> The feature Element
I Quote
If you use the CLI to build applications, you use the plugin command to enable device APIs. This does **not* modify the top-level config.xml file, so the <feature> element does not apply to your workflow.
If you work directly in an SDK and using the platform-specific config.xml file as source, you use the <feature> tag to enable device-level APIs and external plugins. They often appear with custom values in platform-specific config.xml files.
6) Again, you are using the gap: prefix, but in this case you are using it with plugins. You are using outdated names and your are not listing the new source=npm
But again, you did not use the Phonegap Build tag. This leads me to believe you are using a boilerplate, but you are likely using the wrong boilerplate. This is because Cordova/Phonegap has 3 platforms. Read #1 of Top Mistakes by Developers new to Cordova/Phonegap
7) You are using <engine name="android" spec="~4.1.1" />. This and the whitelist entries tell me this is a fairly recent boiler plate. The latest version of Cordova Android is pinned to 4.1.1. See also Platforms and Plugins Version Management -> Saving Platforms
8) You will need to use the whitelist plugin and depending on how your code it written you'll need to use CSP.
In summary, you have components of Phonegap Build, Phonegap SDK, but your post indicates you are using Phonegap CLI. You will need to unscramble the mess you have before you can proceed.
Lastly, you cannot be installing from Play Store, because if you got "from the Play Store, I get no events or page loads whatsoever." as you say – you would never be in the store to begin with.
I strongly recommend you start over and do ONE (1) plugin at at time, else you will drive yourself crazy. And for that matter, at this point in time the best I can do, is point you to restart your work. As such, here is some reading: Top Mistakes by Developers new to Cordova/Phonegap – Best of Luck
I have tried to build my app on Phonegap with plugin and got error for Android:
"Error - Some official plugins have to be updated if using PhoneGap >= 4.0.0. Please upgrade the version of any plugins that may include the following file: LocalNotification.java".
So i changed the source for plugin from:
<plugin name="de.appplant.cordova.plugin.local-notification" source="pgb"/>
to:
<plugin name="de.appplant.cordova.plugin.local-notification" source="npm" />
and now i get error for IOS build that says:
"Error - The following plugin, plugin version or a dependancy of this plugin is not on npm: de.appplant.cordova.plugin.local-notification"
So when i use one source i have build for Android but don't have for IOS, and other source allowes me to build IOS but not Android. Also if i don't set the version, it should use the latest one, making my first error message unclear to me.
What should i do?
Double check the version of phonegap you maybe using.
If you are using the remote build process here and have an old version of phonegap running then your problem maybe that your plugins are configured for a local build not a remote one.
Basically, this:
<plugin name="de.appplant.cordova.plugin.local-notification" source="npm" />
is actually this:
<gap:plugin name="de.appplant.cordova.plugin.local-notification" source="npm" />
with older versions of phonegap. More info here.
Your options maybe to upgrade to a newer version of phonegap or change the plugin declarations as I have shown above.
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
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)