Friday, August 1, 2014

Releasing a Signed Cordova Apk from NetBeans 8

I'll show how to build a cordova android app in NetBeans 8, and release a signed apk file.

The first part is relatively easy. Start up NetBeans 8, and from the main menu select File -> New Project. This brings up the New Project dialog.

In the dialog 'Categories' open the Samples folder and select the HTML5 subfolder. In the dialog 'Projects', select the Cordova Maps Sample, and click Next, name the project and click Finish:


This generates the application. Open index.html in your root, connect your android phone to the usb and hit F6 to run the project.

You should see something like this on your phone:



That was the easy part. Net beans doesn't have any menu selections to build a signed apk that you can distribute. However, Cordova uses an ant build process, and NetBeans is ant friendly.

So, the first thing you need to do is create your key:

$ keytool -genkey -v -keystore myapp.keystore -alias myapp -keyalg RSA -keysize 2048 -validity 10000

The keystore utility will walk you through some questions. You'll need to enter your app name and password, app alias, alias password and developer name. The remaining can be defaulted.

Now, in NetBeans project explorer, select the files tab, and create a file named ./platforms/android/ant.properties. entering the following contents:

key.store=/home/bruce/Git/myapp/myapp.keystore
key.alias=myapp
key.store.password=password
key.alias.password=password


Now you can right-click on ./platforms/android/build.xml and select Run Target -> release:




It will take a minute or two, and the ant build process will generate  ./platforms/android/bin/MyApp-release.apk, a signed distribution file.







Maybe I was wrong - with a little tlc, NetBeans does have a menu selection to build your apk!



89 comments:

  1. Great tutorial so far, but I do not have a target "release" in my build.xml. Any hint on this?

    ReplyDelete
  2. The build.xml imports commands like release from "${sdk.dir}/tools/ant/build.xml". So you won't see that target in the file if you visually inspect it. But when you right click on it in the project explorer, the command should be selectable - netbeans stitches it all together behind the scenes.

    If you aren't seeing a release command when you right click, my guess is that netbeans isn't finding your android sdk - you can set the path to it at tools>options>Miscellaneous/Mobile Platforms.

    ReplyDelete
  3. Netbeans is already running with android sdk (I am already running my project with the android device). But really no target "release" for the build.xml, see screenshot: http://postimg.org/image/kdpmsylot/

    ReplyDelete
    Replies
    1. I see the problem. You need to use the build.xml in the ./platforms/android folder - you're selecting the build in the ./nbproject folder - that one wraps the cordova command line, which, it seems. does everything except create a signed .apk :)
      I've updated the image on this posting to clarify that better.

      Delete
    2. Thanks for your help, but the build.xml in the android folder has got -no- targets in its popup menu. I can only choose "advanced". I guess I will give it up.
      So far I use the signed package, delete the meta-inf folder in it (http://stackoverflow.com/questions/5089042/jarsigner-unable-to-sign-jar-java-util-zip-zipexception-invalid-entry-compres) and sign it manually over command line :(

      Delete
  4. The way bruce described works with the constallation Netbeans 8.0.0 and Cordova 3.4.0-0.1.2 (thank you Bruce!). Because of a security issue on cordova I needed to update cordova. Now with Netbeans 8.0.1 and Cordova 3.6.3-0.2.13 the commands aren't found by the build.xml file. After comparing both projects I found the following difference:

    The file platforms/android/local.properties in my new project was empty and should be generated/modified automatically.
    # This file is automatically generated by Android Tools.
    # Do not modify this file -- YOUR CHANGES WILL BE ERASED!

    I modified the file manually with the path to the sdk (thank you again bruce for the hint from 2014-10-01), e.g. for windows:

    sdk.dir=D:\\adt-bundle-windows-x86_64-20131030\\sdk

    Now the commands are found by the build.xml file. :)

    ReplyDelete
  5. i dont understand this line., where should I do this code?

    $ keytool -genkey -v -keystore myapp.keystore -alias myapp -keyalg RSA -keysize 2048 -validity 10000

    ReplyDelete
  6. Keytool is a command line utility that ships with the jdk. I just opened a command window in my project folder, and ran it there - in my example, that would be /home/bruce/Git/myapp/

    For a full explanation of keytool and its parameters, you can check out the oracle documentation:
    http://docs.oracle.com/javase/8/docs/technotes/tools/unix/keytool.html

    ReplyDelete
  7. I don't have a build.xml file, but there is a build.gradle file. Did the build process switch from Ant to Gradle, and is this something to do with Netbeans or with Cordova? (Using Netbeans 8.0.2).

    ReplyDelete
  8. I'm also using netbeans 8.0.2. My two existing cordova projects work just fine. But when I just tried to create a new one, the new project wizard fails, says I don't have cordova. What I do have is the newer version of cordova (5.0.0) - The projects that are working for me use Cordova 3.x,. It sounds like Netbeans hasn't kept up.

    I found this on cordova's doc: "Cordova for Android now supports building with Gradle. This is optional in Cordova 3.x, but will be enabled by default in the future, probably with Cordova 4.0."

    If you are married to Netbeans, I'd try downgrading the cordova version. I've actually been using AndroidStudio lately for creating APK's. Intel's XDK works pretty well, too, if you can get past the editor.

    ReplyDelete
  9. This is an excellent post I seen thanks to share it. It is really what I wanted to see hope in future you will continue for sharing such a excellent post. Latest APK File

    ReplyDelete
  10. Many Android users are not very much aware about these applications. It is quite simple and easy to learn more information about these files.
    showboxdownloadsapp.com

    ReplyDelete
  11. This comment has been removed by the author.

    ReplyDelete
  12. Usually, your Android device will automatically install the APK. However, if the application that you have is not from the Android Market, you need to make sure that you install it manually in your device. This step is needed so that your apps will run successfully without any hitch.ShowBox APK

    ReplyDelete
  13. Absolutely fantastic posting! Lots of useful information and inspiration, both of which we all need!Relay appreciate your work.
    Gb Instagram

    ReplyDelete
  14. It is possible for a person to install APK files directly in devices. This can be done without necessarily downloading them from any network. You can use a desktop computer and use different communication programs.
    appmirror

    ReplyDelete
  15. Excellent and very exciting site. Love to watch. Keep Rocking.
    Diving in Cabo
    Scuba Diving in Cabo

    ReplyDelete
  16. I am definitely enjoying your website. You definitely have some great insight and great stories.
    metsec wall
    metsec cladding rails
    curtain wall detail
    timber cladding details

    ReplyDelete
  17. Thanks For sharing this Superb article. I use this Article to show my assignment in college. it is useful For me Great Work.
    certified Ethical Hacker nj
    comptia linux plus nj
    mcsa certification
    mcsa certifications

    ReplyDelete
  18. It’s laborious to find educated people on this subject, however you sound like you realize what you’re speaking about! Thanks download lucky patcher

    ReplyDelete
  19. I haven’t any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us. cyberflix tv ios

    ReplyDelete
  20. Please let me know if you’re looking for a article writer for your site. You have some really great posts and I feel I would be a good asset. If you ever want to take some of the load off, I’d absolutely love to write some material for your blog in exchange for a link back to mine. Please send me an email if interested. Thank you! Charlies Magazines

    ReplyDelete
  21. I’ve read some good stuff here. Definitely worth bookmarking for revisiting. I surprise how much effort you put to create such a great informative website.
    Balance CBD
    Best CBD Products
    Buy CBD Oil
    CBD Edibles

    ReplyDelete
  22. I am definitely enjoying your website. You definitely have some great insight and great stories.
    Vishnu swasthi yoga
    Yoga Classes in doha qatar

    ReplyDelete
  23. I am definitely enjoying your website. You definitely have some great insight and great stories.
    we buy homes
    cash for your house
    lease to own
    rent to own

    ReplyDelete
  24. This comment has been removed by the author.

    ReplyDelete
  25. This is helpful for kowning about cordova apk signed version. Thanks admin.

    Learn more about:

    Snaptube

    Ccleaner Pro

    Ccleaner Pro

    Clas of clans update

    ReplyDelete
  26. Good artcile, but it would be better if in future you can share more about this Keep posting.
    Mejor Farmacia Online
    Comprar Farmacia Online
    Farmacia Online en Chile

    ReplyDelete
  27. Keep up the good work , I read few posts this web site and I conceive that your blog is very interesting and has sets of fantastic information.
    hard drive data recovery
    data recovery sharjah
    data recovery abu dhabi

    ReplyDelete
  28. I am definitely enjoying your website. You definitely have some great insight and great stories.
    porn pics
    erotic images
    sexy pics

    ReplyDelete
  29. This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information...
    Versace Eros

    ReplyDelete
  30. In light of humble device, picking information transmission and choice of online gaming, the broadness of the online games are beginning at now right hand in all regards rapidly. The gaming reputation is growing peevishly, so as the degree of players and the degree of people who see it. latest breaking news

    ReplyDelete
  31. To each blog out there, ricocheting on Google News isn't some purposeless wealth. It's a key that effects their very survival. The thing is, Google has gave structures concerning necessities for when to set a site on its system of updates. article

    ReplyDelete
  32. With these sites people are truly conveying their contemplations, their viewpoints, and notion on somebody specifically or point. Regardless, now and again these blogs can similarly be manhandled in light of the way that it is routinely used to defame an individual and de advances that particular person. Blogging type sites are basically sited where people share their very own decision and points of view and they have their very own profile on it with the objective that others can see them. information

    ReplyDelete
  33. They additionally state that an appropriate equalization of everything (their insight, their composition style, their SEO) is sufficient to make them effective as business bloggers. Online magazine

    ReplyDelete
  34. The you have is very useful.The sites you have referred was good. Thanks for sharing...
    Kroger experience

    ReplyDelete
  35. Business blogs are useful in light of the fact that for the most part they talk about understanding. What's more, I imagine that involvement in business checks more contrasted with any book guidance. information

    ReplyDelete
  36. Excellent .. Amazing .. I’ll your blog and take the feeds also…I’m happy to find so many useful info here in the post, we need work out more techniques in this regard, thanks for sharing.

    farmacia

    ReplyDelete

  37. Thanks for sharing knowledgeable information about electronic cigarettes.Its an interesting one but in the case of vapourlites david it is to my knowledge that the authority for medical recommendations is spread across many different bodies and frameworks in the UK.
    https://tellthebelll.us

    ReplyDelete
  38. Thanks for a wonderful share. Your article has proved your hard work and experience you have got in this field. Brilliant .i love it reading.
    iphone data recovery kenya
    data recovery services nairobi

    ReplyDelete
  39. As said before, Finance is a gigantic subject with numerous classes. Indeed, even before beginning your blog composing, settle on what classification you need to compose. Also, significantly increasingly significant is to adhere to it. This is significant on account of the nearby between connection of these classifications that can undoubtedly divert you to an alternate class all together, and without your insight. For eg. You may begin composing 'On the best way to deal with your Personal Finance'. There comes one pivotal point in it about reimbursing your high need obligations. Here you can without much of a stretch wind up expounding more on that and disregard different purposes of planning. https://helpwithfinance.org/

    ReplyDelete
  40. When you have chosen what you have to get away from the relationship and the site you are searching for, you are then ready to pick an online dating site to locate that person on. As communicated already, there are a large number sites with millions, even billions of people on them. Regardless, where might it be a smart thought for you to start your search? Make a summary of the things you need and balance each site with your once-over. In case a site has all of the things you showed, put a checkmark close by its name. If not, mark it off your once-over. Dating Websites

    ReplyDelete
  41. Home improvement tips, for example, ensuring you mark outwardly, what is inside the compartment in the event that it isn't see through, so sometime in the not too distant future, you will effectively have the option to discover something can help. On the off chance that your holders will be in a room that you need to take a gander at them all the time on the grounds that your storeroom wasn't huge enough to store them in, at that point you have to stack them flawlessly off the beaten path. Home-Improvementnews

    ReplyDelete
  42. Everything considered, in particular, you have to understand that there are a number of websites that offer blogging capabilities. Thusly, you have to pick one of them. A person who needs to start blog writing can sign up with a part of these websites for free. The Daily Mint

    ReplyDelete
  43. They can capably juggle between studies, sports, PCs and phones. Internet, social networking and talking have effectively excited children wherever all through the world. Excess technicality is also adversely influencing their imagination. Children now-a-days are bound to make just to visit and mailing. At this stage, the standard investigation corridor capability, fail to satisfy the requirements of the age, is losing to online education blogs. Best Educational Grants

    ReplyDelete
  44. The peril related with the Internet shopping is twofold. The chief danger is the methods by which secure the site is. Shopping with credit or debit cards suggests you should give out a wreck of personal information. None of us may need this information to fall into an unseemly hands, or we could be in for an outrageous time. In spite of the way that we have many committed and reliable shopping and auction sites, we continually need to go to solitary business sites to get the new things. Subsequently, it is fundamental that we as purchasers should know whether this site is just one more blackmail or a stunt. Shopping Blog Gen

    ReplyDelete
  45. The article was up to the point and described the information very effectively. Thanks to blog author for wonderful and informative post.
    data recovery services kenya
    mobile data recovery kenya
    hard disk recovery nairobi

    ReplyDelete
  46. This will save you a lot of time experienced checking in with each marriage blog only. If you like to contribute just a little vitality remaining mindful of wedding news, there are some uncommon wrap up regions which round up the top stories from an assortment of wedding blogs and post them no matter how you look at it invaluable pack. Most in like manner have blogs which are invigorated each day, despite the way that the information isn't continually about late advancements. A couple of goals, like Brides, are revived more as frequently as conceivable than others. Your favored site will depend upon what kind of wedding news is most interesting to you. Atl Wedding News

    ReplyDelete
  47. This is highly informatics, crisp and clear. I think everything has been described in systematic manner so that reader could get maximum information and learn many things.
    Tax preparation service

    ReplyDelete
  48. The article was up to the point and described the information very effectively. Thanks to blog author for wonderful and informative post.
    web link

    ReplyDelete
  49. The article was up to the point and described the information very effectively. Thanks to blog author for wonderful and informative post.
    파워볼
    파워볼게임사이트
    파워볼밸런스

    ReplyDelete
  50. We provide loading and unloading moving services for your rental truck, PODS, self-storage, warehouse, trailer, U-Haul truck, Penske truck, Budget truck, or any moving van at our Denver moving company. Need local or long-distance moving labor? Let our professional movers load and unload your furniture. Fischer Van Lines provides amazing movers in Denver.

    ReplyDelete
  51. The truth is, there exists more into it because you need to make sure your tenants are happy constantly along with the contractors are going to do their task. To slice the long narrative brief, there is a lot more to property managing than many people often believe. On this page, we are going to take you through the top secret for being an effective property management. Eenhoorn Development

    ReplyDelete
  52. A chatbot can also be defined as an artificial intelligence program designed to simulate a customer service representative. It’s designed to automate many of the customer support processes, mainly by providing answers to some of the questions that customers ask. are chatbots beneficial in Singapore

    ReplyDelete
  53. The aim of GutscheineDeal.de is to help you save. On our site you will find a large number of vouchers, voucher codes and deals that we have selected for you. Our team always provides you with the best bargains on GutscheineDeal.de. Toolineo Rabattcode

    ReplyDelete
  54. Bicupid has lots of friendly features for members to find their matches and connect with other members. bi cupid

    ReplyDelete
  55. We always think of those who are looking for something authentic or bold that they will not find elsewhere. If you are a fan of modern style and like to experiment, you are in the right place. In addition to making women's shoes, Lucci Verrosi makes women's boots, women's sneakers, women's moccasins and women's slippers. zenske mokasine

    ReplyDelete
  56. On an astounding supervisor level make utilization of ePic Character Generator and you are a bewildering game-plan to go. To find out an immense measure of more concerning this avatar maker, you will from the most strong starting stage need to visit the official site of Overhead Games. character generator

    ReplyDelete
  57. A surprising blog doesn't misdirect the reader, yet rather lay the cards in each point. This is one structure for letting the reader to consider the genuineness of the issue and the bore witness to pieces that support it. Over the long haul, people will take trust in the substance of the blog if the certified parts are there and all data staggering has been picked with have a solid explanation and manner. Paulfestival.org

    ReplyDelete
  58. Bloggers often start a blog and after that article inconsistently. Prospective customers will want new information to ensure they are curious and definately will forget about your site if they are waiting around for new materials. A great rule to go by is always to create new blogs every week, and send out emails regarding the upgrades. Create new blog posts as often as possible. Fashionistaloves

    ReplyDelete
  59. If readers watch you respond to audience remarks, they may return to your site hoping to read through a answer. It is very important that you blog about an issue that interests you. When you are covering things that you actually care about, you can expect to appear to be much more intriguing and much more trustworthy. Besteducationalgrants.org

    ReplyDelete
  60. If you want to withdraw your money that you may have won, it is actually even easier, just look for the withdrawal opportunity of the game you played at, usually it is up to the menu. Then choose the amount you want to withdraw and to which bank you want the profit to be. Verify yourself with your BankID and wait a short while. 888 casino

    ReplyDelete
  61. We believe that the experience of completing timed, mock papers is an essential advantage for all children aiming to succeed at their entrance exams, and we are very proud to bring you a range of practice papers with a particular focus on the Sutton Selective Eligibility Test, Kent Procedure for Entrance to Secondary Education, Consortium of Selective Schools in Essex, Tiffin School entrance exams and the Bucks Secondary Selection Test. Grammar past papers

    ReplyDelete
  62. Every player who relies on an online slot agent will rise triumphant. Truth be incited, some are inclined toward losing money to the degree they would bolster not to try it again. If this shows up you, by then this is your day of vengeance. Here are tips you can use when looking forward to changing into a genius at online slot sites. slot online

    ReplyDelete
  63. We understand how important it is for residential movers to quickly transform their new property into their new home, which is why we have worked hard to set ourselves apart from other moving companies who care more about raising your quote than providing quality. moving company

    ReplyDelete
  64. In addition to its convenient and sturdy design, this spin bike comes with an advanced smart computer capable of tracking your workout performance. It displays the time spent, your heart rate, distance covered, and calories burnt. In addition to being a smart bike, the Pooboo Pro Indoor Cycling Bike has these impressive ergonomic PU seats that offer an additional level of comfort. home exercise equipment for seniors

    ReplyDelete
  65. Among adventurous, fun-loving designers and homeowners, red kitchen cabinets have become a favorite. They add a flair of chic stylishness to the kitchen space that many find irresistible. Moreover, red cabinets are extremely effective at breaking the monotony of the traditional kitchen décor, which is usually dominated by shades of brown, white, and black. red kitchen cabinets

    ReplyDelete
  66. As experts in children’s play and development, our team at Schoolscapes produce project designs that are beautiful, purposeful, and created with your pupils’ physical, emotional, and learning needs in mind. Our experienced play consultants and award-winning designers combine their expertise to create high-quality playground equipment that fits all age ranges, abilities and has even been shown to improve Ofsted ratings. school playground equipment

    ReplyDelete
  67. This comment has been removed by the author.

    ReplyDelete
  68. INDIAN VISA PASSPORT SERVICES

    INDIAN VISA PASSPORT CENTER has been offering its services like Indian Visa services, Indian passport services, OCI Services,
    Indian passport renewal services in USA. If you want to get these service then INDIN VISA PASSPORT CENTER is the best
    platform.


    Indian visa passport services

    ReplyDelete
  69. Red Hat Plumbing is regarded as the best locally-owned plumbing company in Granada Hills. Our company is fully licensed and insured. We offer rates that are fair and affordable. Our plumbing services in Granada Hills can be employed for both residential and commercial properties. plumber granada hills

    ReplyDelete
  70. Some people think that its hard to get the cabinets in the kitchen when they are remodeling, and Shakers make it very easy to get cabinets installed, which is very important. When you're looking at Shaker kitchens, keep as an essential need that you'll get everything from the cabinet to the flooring and tapestry, every last piece of it in the Shaker style. shaker cabinets

    ReplyDelete
  71. MTS_BATH_ACCESSORIES

    Mishra enterprises has the wide collection of bath accessories
    and other sanitary ware products in India
    we are manufacturing the most reliable products.

    mtsbathaccessories

    ReplyDelete
  72. Waist Trainer for Women Corset Waist Trimmer Body Shaper Belt can easily wrap around your abdomen, providing adjustable tight pressure to shape your hourglass curves, which is ideal for women to lose weight on a daily basis and is the perfect gift for those who want to stay in shape/relax belly fat, recover after giving birth, and support their backs. Waist Trainer Butt Lifter

    ReplyDelete
  73. The Bungalows Office Space hosts on-site food and coffee and an expansive outdoor space and patio area. You will love these new creative spec office suites that will enhance your work life and provide endless opportunities for you and your team. Our Del Mar office space for lease include high open ceilings and operable windows that create a relaxing and beautiful workspace. del mar office space for lease

    ReplyDelete
  74. Internet affected traditional marketing significantly. Understanding just how big the internet is may be the first step to understanding why internet marketing is becoming so important to businesses. As previously mentioned, the internet connects millions of people from all over the world. Look at social media websites such as Facebook which has over 800 million active users every day. 1:1 marketing

    ReplyDelete
  75. High quality products and materials are a must and at Zodiac Garage Doors, we only use the best materials on the market. We also have a world-class team of experts and we are second to none when it comes to exceptional customer service. We focus on providing a smooth, hassle-free customer experience and we work tirelessly to uphold the highest standards. garage door repair glendale

    ReplyDelete
  76. One of the most important factors is that the person uses the automated YouTube view increase programs. see it here

    ReplyDelete
  77. According to statistics, about 40% of the population live with elevated cholesterol levels; a condition that potentially doubles the risk of developing cardiovascular disease. Given the popularity of CBD oil in recent years, there has been some debate about using CBD oil to lower cholesterol. CBD oil effectively affects the cardiovascular system, prevents atherosclerosis or coronary diseases directly related to high cholesterol. olejki cbd

    ReplyDelete
  78. The summer days is one of the right time you and your family can have a garden party. With the right gazebo installed in your garden, you will make the most of your relaxation. Our products are ideal for any outdoor events that you want to carry out. Whether it is a garden party, a family get together or a sit-in, the garden will provide the best design. Gazebo garden

    ReplyDelete
  79. Very efficiently written information. It will be beneficial to anybody who utilizes it, including me. Keep up the good work. For sure i will check out more posts. This site seems to get a good amount of visitors. casual shoes for girls in pakistan

    ReplyDelete
  80. If the colorized photo is reddish or has more red tones in the colored photo, it can be corrected by moving the temperature slider to the right which I usually do especially to reduce the red tones on the skin. This slider is useful to correct the skin colors along with the Gamma Correction slider. black and white to color photo

    ReplyDelete
  81. The company uses a tricky credit check that won't impact your credit score. A brief timeframe later, you can set up a payment schedule that fits into your current budget. With the right loan provider, you can do whatever it may take not to become fundamentally covered in debt. loan

    ReplyDelete