I am trying to upload some code html and javascript code into phonegap to develop this app however when I update the files the program still runs the old code as to what was in the html file before. I have even started a new project and it will not change the old index.html image even though the code behind it is different. I'm really confused as to why this is and I was wondering what I could do to solve this. I even searched through the workspace index.html file and it is the correct file that I want in there but upon running it i am given the same your device is ready hello world. I checked the location of the files and everything is correct. It is very confusing. I am using eclipse by the way not phonegap build if that helps.
you need to build your project again.
cordova build android
But make sure you edit your files in www folder in parent folder.
Make sure you are updating the WWW file in the root Phonegap folder. Then you can run the command:
$ cordova build
or
$ phonegap build
Related
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>
I am making a Cordova app using Framework7 for iOS/Android. I'm trying to add the social sharing plugin and the barcode scanner plugin but the plugin functions can not be called. However when I made a Cordova app with plain HTML and JS (without Framework7) the plugins would work. Is there anything I have to modify on the Framework7 side to enable these Cordova plugins to work?
cordova.js file need not be there in your project root directory. Everytime you do a particular platform build, it gets automatically created in the platform build's project root directory.
For instance, if you build android platform using 'cordova build android' command, the cordova.js file will be generated under 'platforms\android\assets\www' folder. This js file is very much required to use any of the cordova plugins as it is the one which is responsible for triggering 'onDeviceReady' event once the cordova is ready and all plugins are loaded. You can also have a look at the generated file once to get more info on the same. Hope it helps.
I installed PhoneGap with nodejs, and I sent the create command to create a folder with the basic files needed for the first app. When I open the index.html file there is a script tag that points to a file called phonegap.js. The problem is that this does not exist in the folder, where is it? The app is running if built without that file or not?
That is my folder:
My object is to create a basic app working.
Thanks.
The file is created when you add a platform to your project (because its content is different for each platform)
For example, for an android project it should be in platforms/android/assets/www/phone gap.js.
i'm new to Mosync and i'm trying to create an HTML5/Javascript project. The IDE generates a main.cpp file and an index.html file.
The main.cpp file contains a reference for the index.html file; i've already tried creating a new html file inside the same folder where the generated index.html file is and changed the reference in the main.cpp file to call the file that i've just created but it gives me an error that says the file cannot be found.
I've even tried removing all the code in the generate index.html file and running it and the results still shows all the deleted code from the index.html file.
My question would be how do i add multiple html files when creating a MoSync project?
It should work to do what you are doing, this could be a bug. Can you provide some details about which version of MoSync you are using, and which platform?
You should be able to have any html file in the folder LocalFiles in a MoSync project, and then just pass the file name to showPage in main.cpp, just as you are doing.
Perhaps the project is not rebuild properly? Try to right-click on the project in Eclipse, then select Rebuild. Are you on iOS or Android? How do you transfer the app to the device?
As Mikael mentioned also, I think it is an IDE bug, I tried refreshing/rebuilding the project and it worked fine. Sometimes eclipse does not detect file changes that come from other editors so it ignores them.
I am trying to build a PhoneGap-based iPhone application, but I keep getting the following two errors:
./build-phonegap.sh: line 6: ./configure: No such file or directory
cp: lib/iphone/phonegap-min.js: No such file or directory
I built and installed the latest version of PhoneGap from the source on GitHub. I have checked to make sure that the PHONEGAPLIB variable is indeed set in XCode.
Where do I get the files listed? Where do I put them (to what are those paths relative)? And why aren't they already there?
Later
It seems the problem was that the project had been created with one version of PhoneGap (one that doesn't reference an external lib directory), but I was trying to run it with a newer one. Recreating the project with my latest version and copying over the www directory fixed the problem.
I am confused. What steps do I take? I just downloaded phonegap. I don't know how to "install" it. Do I have to run some git command or some build command before I can open it in xcode?
UPDATE:
Figured it out. I downloaded it. Unzipped it. Went into the phonegap folder. Duplicated the iphone folder. Opened xcode and hit build and go. It worked.
Apparently your iphone gap projects need to be a subfolder of the phonegap folder. That can probably be fixed/changed if you know what you're doing.
This video here helped me verify that all you need to do is download, unzip and open. The files inside your www do work by default.
http://www.youtube.com/watch?v=LcES5nIbMkk