I started PhoneGap today only. I have experience with native code but not with HTML5 stuff. I am comfortable with GUI so CLI is new to me.
So I am trying to build app in android. But it uploads data to remote site & as its my second app, Its says "Private app limit reached".
Is there any way to build file locally?? Like with no internet connection. Screenshot attached for further refrence. Thankyou in advance
If you look at the Android platform guide section of the PhoneGap documentation you'll get instructions for setting up your SDK locally.
Pay attention so that you got your PATH setup correctly, a quick way to verify that on windows is to type echo %PATH% in the command prompt. If you already had your command prompt open as you set PATH it'll not be reflected so you've to close cmd and open it again.
After the SDK is setup successfully and you got your PATH verified you should be able to do the following to run it:
phonegap install android
phonegap local build android
phonegap local run android --emulator
Related
My project is deployed on live server; I want to make some customization, but it's live, so I am having same backup on Mac and doing customization. I just put this code (meteor run ios-device --mobile-server=http://localhost:3000 --production) in run-mobile.sh and I ran the same command (meteor run ios-device --mobile-server=http://localhost:3000 --production) in meteor directory.
My application is getting open in Xcode simulator and running well, but I am unable to see my customized code: it's still showing codes coming from server, but I want to run the iOS app with localhost, not with live server.
Does there need to be any other file, or do I need to change that file which I did not find? If so, where I can found that to set localhost?
If you execute just meteor run ios-device, it starts a local meteor server and opens Xcode. No need for the --mobile-server option.
You also don't need the --production option. According to the meteor help, it's just to:
Simulate production mode. Minify and bundle CSS and JS files.
I built an app on Meteor, and deployed it to a Digitalocean server using mupx. On my local machine (where the android SDK is installed), I built the app for android with the following command:
meteor build --server=http://SERVER.IP /output/directory
I then signed the app and put it on my phone, and it runs fine, and is connected to the database. The problem is that, when I change code on the server, it doesn't automatically get pushed to the app. The only way I've been able to update the app is to build a new .apk and put it on my phone.
Some background info:
I don't have the android platform on the server, only on my local machine, and the hot code push works in the browser when I go to the IP.
Well, it seems I answered my own question in the question. You really do need to have android on the server, as well as the SDK. Just look up instruction to install the android sdk on a server (no gui). Now it works.
From 1.3-beta.12, added a --server-only option to meteor build that doesn't require the mobile SDKs to be installed on the build machine, but that will still build web.cordova whenios or android platforms have been added to the project.
Reference: meteor forum
I just recently installed apache cordova and am trying to get it up and running properly. I'm using a macbook pro running 10.9.5. My android SDK is the latest (22, but android target build uses 21). The cordova version is the latest as well (4.3). This issue occurs with any example app that I've tried, including the basic app/page that gets installed when you create a new cordova project (i.e. cordova create...).
For the most part, everything seems to be working ok, with one exception. When I try to view the android version of the test app in a browser (any browser - tried chrome, firefox, safari), I get various prompts that show up on the init/load of the app. The first prompt window to popup up says "gap_init:2", which is generated from the androidExec function in the cordova.js file:
androidExec.init = function() {
bridgeSecret = +prompt('', 'gap_init:' + nativeToJsBridgeMode);
channel.onNativeReady.fire();
};
If I cancel thru these prompts (there are 3 prompt windows), then the app seems to load ok. If I 'ok' thru these prompts, then the app gets into an infinite cycle of processing empty messages, and I have to kill the browser processes to stop it.
The iOS version of the app loads fine in every browser. I've tried changing the android target to version 19, but the prompts still occur. There are no error messages during the build process.
Does anyone have any insight into what might be causing this? How is this prompt message supposed to be caught/handled?
Its simple, from visual studio, on running, it opens web pages for Android /iOS environment, you would have tried to cut-short the url to open for web version, this is when you will get dialog's as you mentioned.
To overcome this problem map the www folder to your local iis / iis express and open the url, page will open without any error.
This error you get when you use the following command directly as follows:
ionic serve
and then followed by
ionic cordova build android --prod --release
I SUGGEST TO FOLLOW THIS METHOD, IF YOU WANT TO RUN THE APP IN BROWSER
ionic serve
ionic build
ionic build --prod
This way you get www folder where you can upload to server and check the whole app in browser directly
So I asked and answered the question [how to do Phonegap 3.0 without Phonegap Build][1]. Now my app is ready for iOS as well (I think) and it's time to start deploying and debugging for that platform.
The formal question: how can I add the iOS platform to a Phonegap 3.0 project?
This answer is still in progress.
Goals I've achieved:
Compiling the project in command line, then running on device or sim using xCode
Attempts failed:
Compiling and running (device/sim) all from the command-line
1. Creation
I could easily add the iOS platform as described in the docs' iOS Platform Guide.
Basically, if the project already exists because you did Android first, this is how you set up the iOS app structure.
$ add platform ios
Then you should add files to the main /www folder if you didn't already have them from your Android work. Then this takes care of creating the app in debug form:
$ cordova prepare //Creates all the necessary source filed
$ cordova compile //Creates an ipa file
//Alternatively, do both in one go with cordova build
2. Deploying to device
But it is completely unclear how to use the command line interface to actually deploy the test app to device or emulator.
When you attach a physical iOS device, and simply try this from the main project folder...
$ cordova run ios
You get a pretty clear answer:
[Error: An error occurred while running the ios project. Targeting a device is not supported currently.
]
So I've resigned myself that for device testing, I must still use xCode. No biggie. However, xCode cannot "refresh" the project by itself after you've updated your files, so in between deploys you must go back to the command-line to recompile the iOS app.
Strangely, when I update my code, I do need to use "cordova run ios" (even with the above error) in order for the the /platforms/ios/www folder to be updated. So this is what works and does not work:
$ cordova run ios
//Rebuilds the app with main /www files successfully,
//then tries to deploy to device and fails in that.
$ cordova prepare ios
//Does not rebuild with main /www files
//(Also does not deploy but that is not its intended function)
And remember that you also need to clean your xCode project in between runs. So the sequence is:
Previous run
Edit your code
In console, do: cordova run ios
In xCode, Menu bar > Product > Clean product
in xCode, Run
3. Deploying to emulator
Still, "deploying to device is not possible" begs the question "What about emulator?"...
The docs page on the 3.0 command-line interface mentions you should enter the command
$ /path/to/my_new_project/cordova/run
This had me all confused. What kind of path is that? From where are you supposed to run it? Is it a nice way of providing a command you can run from anywhere? Why force me to enter my annoyingly long project path for each command?
Confusingly, the run command doesn't work if you actually go to the "platforms/ios/cordova" directory where the run executable is located.
The trick is to be one directory lower, i.e. at the /platforms/ios subfolder of your Cordova app project. There you type "cordova/run". Then in my case it starts building.
4. Install "ios-sim"
But that was not the end of it. I subsequently get an unanticipated error about "ios-sim" not being installed.
[...]
** BUILD SUCCEEDED **
Error: ios-sim was not found. Please download, build and install version 1.5 or greater from https://github.com/phonegap/ios-sim into your path. Or 'brew install ios-sim' using homebrew: http://mxcl.github.com/homebrew/
Fortunately that project webpage has adequate documentation on how to install. However, even after adding the ios-sim directory to my $PATH, when I want to emulate I get the following error.
$ cordova emulate ios
[TypeError: Arguments to path.join must be strings]
This is where I am currently stuck. My path looks exactly like this (all in one line):
export PATH=${PATH}:/Applications/adt-bundle/
sdk/platform-tools:/Applications/adt-bundle/sdk
/tools:%JAVA_HOME%\bin%ANT_HOME%\bin:"/Users/
cool/Library/Developer/iossim"
What am I doing wrong? I've tried with and without doublequotes, and I've even renamed the ios-sim directory to iossim in case the hyphen was the problem. No effect.
So no simulator for now.
5. Install to iOS App Store
This is the point where Phonegap really leaves you out in the woods. Maybe because they want you to use their paid app publishing service, but also because the process of publishing an iOS app is basically soemthing you do using xCode, iOS Developer Portal, and iTunes Connect.
So here that goes:
You need to have all the right certificates and profiles for your app (yes, it's a bunch of incomprehensible virtual documents that all require each other, Apple is like the Soviet Union of app stores).
You request those certificates and profiles in the iOS Developer Portal, save them to disk, then double-click them so that xCode knows you have them and will include them in your app.
This is the docs page for xCode 4 on how to publish your app.
The most counter-intuitive bit is that in order to publish your app, you first have to create an archive of it in xCode (Open your project in xCode > menu bar > Product > Archive).
When the archive is made, you will see it in the Organizer view under the Archives tab. There should be two buttons: Validate and Distribute. Validate checks and includes all your profiles and certificates in the app, and it also checks for errors like a wrong version number.
Distribute does what it says: it sumbits the app to the App Store.
Congratulations! (Now wait five days)
I'm trying to install my Phonegap application onto an Android AVD/Emulator. I have launched the AVD and it's registering as 5554:Nexus_S.
When using the Phonegap commands at the Windows prompt I am typing:
phonegap build android
phonegap install android
The output I get says it successfully installed the app onto the device, but it never shows up. This is the output of the install command:
[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] trying to install app onto device
cp: dest file already exists: C:\Users\username\app\platforms\android\assets\www\phonegap.js
[phonegap] successfully installed onto device
I've tried variations of targeting the device using options with no luck:
--device=5554
--target=5554
Any ideas?
I figured it out. You have to specify the --emulator= in the call, so the command looks like:
phonegap install --emulator=emulator-5554 android
You can find the name/id of your running emulators by running the list-started-emulators.bat under the /platforms/android/cordova/lib/ folder in your project.
Another quick note is that sometimes even when you have started the emulator phonegap will not recognize it... so you have to start it from phonegap bat file so that the right process number is registered. to do this.
Use the following command,
1. List-emulator-images.bat : This will display available emulator images you have
2. start-emulator : This will start the emulator which will register with phonegap.
Also make sure you are running all of this from and ADMIN Enabled command prompt.
Okay, I've solved my problem. This solution may not be applied to all, but I was suffering from the same problem as I've mentioned in the comments of the question.
What did I do wrong?
I made some changes in one of the plugins.
I was working on my app and added the Vibration plugin. I made some changes in the plugin, both in the generic version [your_project_root\plugins\org.apache.cordova.vibration\src\android\Vibration.java] and also in the platform specific version [your_project_root\platforms\android\src\org\apache\cordova\vibration\Vibration.java].
But when I reverted the changes back, everything went fine.
I say it again, this solution may not be generic but can be useful for at least my type of problem.
And this gives rise to another question, can't we make changes in the Plugins?I think it is totally fine to make changes in them. Maybe I had done something wrong.