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.
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" />
I'm new to Phonegap (using CLI to start the project and manage it, and desktop to serve, both running on Windows8),
This is what I've done so far:
phonegap plugin add cordovarduino
Fetching plugin "cordovarduino" via npm
Plugin "fr.drangies.cordova.serial" already installed on android. Making it top-
level.
Plugin "fr.drangies.cordova.serial" already installed on browser.
On the project;
serialMonitor: function(){
app.debug("Initializing Serial Monitor");
try {
//cordova.require("serial.js");
serial.requestPermission({
driver: 'FtdiSerialDriver' // or any other
},
function success(){app.debug("Granted access");},
function error() {app.debug("Denied access");}
);
}catch(err) {
app.debug("Error: "+ err.message);
}
}
In platform/android/res/xml/config.xml:
<feature name="Serial">
<param name="android-package" value="fr.drangies.cordova.serial.Serial" />
</feature>
But in platform/browser/res/xml/config.xml, there wasn't added, so I added it manually, as
<param name="android-package" value="fr.drangies.cordova.serial.Serial" />
and then replaced as
<param name="browser-package" value="fr.drangies.cordova.serial.Serial" />
Also included cordova.js and called serialMonitor() on ondeviceready event.
But I'm still getting :
serial is not defined
Maybe is not a bug!, any help please?
Alright, after struggling against PhoneGap CLI with issues related to Build Tools version, and some other stuff, I've managed to build and deploy on Android the .apk, once there, and ONLY WHEN OTG CABLE WAS PLUGGED AND ARDUINO DETECTED BY ANDROID (info for cordovarduino users), permissions where asked and eureka! "Granted access" was prompt, therefore serial object was found.
Conclussion:
Yes, some plugins are ment ONLY to work (became callable) on some platforms, and PhoneGap Developer App is, correct me if I'm wrong, a browser platform.
So running the compiled apk directly on that platform will allow some plugins to be callable in runtime, otherwise not.
Sorry if this was obvious to many people, but it was my first day on PhoneGap.
Live long and prosper.
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 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.
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