7 Replies Latest reply on Sep 15, 2016 8:04 AM by shotts@adobe

    phonegap offline build


      Hello guys.

      Please help me with this.

      I have created an application for an andoid phone using phonegap desktop but I don't how to build this one to come up with the apk file for the installer. Is there any way to build the project WITHOUT having an internet connection?I don't want to use the CLI or the command line to do this. I'm using netbook computer with Windows 7 operating system.


      Thank you. I hope you will take time to answer my query.

        • 1. Re: phonegap offline build
          shotts@adobe Adobe Employee

          If you don't wish to use the CLI, the answer is "no". The only way to build the app in this case would be to use PhoneGap Build, and that's certainly going to require a network connection with access to the Internet.


          Is there a reason you don't want to use the CLI?

          • 2. Re: phonegap offline build
            jakec86659707 Level 1

            Thank your for the reply.


            the reason i dont want to use the cli is, It is so hassle to type all the commands unlike the desktop version. Since that is a command base you have to memory all the command like inserting a plug in etc.


            How about creating a project using using the desktop version, would it requires an internet connection?

            if no, what are the things that i needed?


            Ca i create also a new project using CLI without an internet connection?

            • 3. Re: phonegap offline build
              shotts@adobe Adobe Employee

              No offense, but you have to memorize JavaScript, HTML, and CSS syntax and semantics, right? As such, I fail to see why learning to use the CLI is that much more of a burden. If reproducibility is the issue, you can always create scripts that automate the configuration process -- in fact, you should anyway.


              As for forgetting commands and learning about what functionality is available, "cordova help" or "phonegap help" (depending on which CLI you are using) is there for a reason. The docs are also a good place to start. CLI tools are not to be feared nor avoided -- they are extremely powerful, and you're going to need to learn to work with them sooner or later (a lot of JS tooling is CLI based now -- node, npm, gulp, grunt, linting, ES6 support, typescript, browserify, webpack, etc.)


              The PhoneGap Desktop App does not offer mechanisms for adding plugins or platforms. It offers no mechanisms for building app bundles suitable for use on your phone. There are only two ways to do that: use the CLI or use PhoneGap Build.


              The CLI expects that you have access to the Internet as it will download the platforms and plugins you install from npm. You'll also need access to the Internet for the first Android build, since Gradle will need to be configured. After that, you could do without as long as you didn't change your app's configuration. Once you got to the point of deployment to an app store, you'd need access to the Internet again, of course.

              • 4. Re: phonegap offline build
                jakec86659707 Level 1

                Thanks fort the reply.

                I dont have any problem regarding with html,css and javascript.


                If CLI needs an internet connection in installing plugins, how about installing phonegap using this command: npm install -g phonegap. Does it require also an internet connection?

                • 5. Re: phonegap offline build
                  shotts@adobe Adobe Employee

                  Yes; npm downloads phonegap from an online repository.


                  It's best to have an Internet connection at least through the first build. See my other post on this matter.

                  • 6. Re: phonegap offline build
                    jakec86659707 Level 1

                    OK its clear to me now. Thats one of the reasons why I dont want to use CLI.

                    THANK You for replying to my queries. But is it possible that phonegap someday will not require an internet connection just eclipse you can create aproject with out an internet and you can even get the apk file direcly from you project folder for the installer.?

                    • 7. Re: phonegap offline build
                      shotts@adobe Adobe Employee

                      There's a good reason why PhoneGap uses the CLI (or PhoneGap Build) now. Here's some history:


                      Way back in the 1.x days, PhoneGap was indeed distributed as a project template. You could fire up Eclipse or Xcode and create a PhoneGap app using a template. But there were several problems with this:


                      - Difficult to create a cross-platform app environment. You had to manually manage the "www" directories of both project OR use symlink hacking in order to get the two to point at the same "www" directory. The benefit of the CLI is that it takes care of managing the platform "www" directories for you.

                      - Lack of flexibility: project templates can only do so much. PhoneGap CLI and associated platforms actually do a LOT of work for you, including managing (and abstracting) preferences, icons, splash screens, and more. You can do a lot of other useful things with hooks, as well.

                      - Harder extensibility: A lot of what's now a "core Plugin" was built into PhoneGap at the time. Which meant apps needed more permissions than usually necessary, but also meant that extending PhoneGap was a pain in the rear. The CLI takes care of that for us now.


                      Because PhoneGap is supposed to make cross-platform development easy, that first item is a big problem for project templates. Hence the CLI.


                      Of course, the CLI should also be cross-platform -- if you can build native apps on Windows, Mac, and Linux, you should be able to do the same with PhoneGap. IIRC, there was a period where shell and batch scripts were used, but this meant duplicating functionality (and running the risk of a bug only on one platform). So Node.js was used -- Node.js makes it easy to create scripts that work across a variety of platforms.


                      In short, PhoneGap tried the IDE template method and moved away from it. I seriously doubt that they would go back to a method that was problematic and limiting.


                      Also note that if you're managing to get Eclipse and other tools to work, then you've already got at least temporary access to the Internet. Given that you have to be able to install the Android SDK / Xcode in order to use the CLI (Which implies some level of connectivity), then there's little reason in building the CLI in such a way that it expects no access. (That said, there are ways around it, but then you're doing the hard work yourself, and you still have to have access to the Internet at some point.)


                      Also note that, as far as I know, once you get past your first build, I think the CLI should handle the lack of Internet just fine, as long as you don't add plugins or platforms after that fact. If persistent Internet is the problem, then I'd enable it for just as long as you need to get through the first build and then turn it off. Keep in mind that I haven't tried this, so perhaps someone else will point out a reason why it won't work, but based on what I can see, I think it should do the trick.


                      One other note: Eclipse is not the favored Android IDE anymore. Android Studio has taken those reigns. PhoneGap doesn't care (it just needs the Android SDK installed), but it's worth mentioning.

                      1 person found this helpful