{"_id":"56d1f33d00a2a70b00b365e1","__v":0,"version":{"_id":"56d1f33700a2a70b00b3658e","project":"5526c95cf69851170038b48f","__v":2,"createdAt":"2016-02-27T19:04:23.946Z","releaseDate":"2016-02-27T19:04:23.946Z","categories":["56d1f33900a2a70b00b3658f","56d1f33900a2a70b00b36590","56d1f33900a2a70b00b36591","56d1f33900a2a70b00b36592","56d1f33900a2a70b00b36593","56d1f33900a2a70b00b36594","56d1f33900a2a70b00b36595","56d1f33900a2a70b00b36596","56d1f33900a2a70b00b36597","56d1f33900a2a70b00b36598","56d1f33900a2a70b00b36599","56d1f33900a2a70b00b3659a","571f9497ada30c34003b7cee"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"beta","version_clean":"2.0.0-beta","version":"2.0.0-beta"},"user":"5526ca4cf69851170038b496","category":{"_id":"56d1f33900a2a70b00b36596","__v":1,"project":"5526c95cf69851170038b48f","pages":["56d1f33d00a2a70b00b365df","56d1f33d00a2a70b00b365e0","56d1f33d00a2a70b00b365e1","56d1f33d00a2a70b00b365e2"],"version":"56d1f33700a2a70b00b3658e","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-10-12T20:12:57.656Z","from_sync":false,"order":6,"slug":"ionic-package","title":"Ionic Package"},"project":"5526c95cf69851170038b48f","parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-10-07T15:40:10.543Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":2,"body":"Let's walk through generating a Package build for Android. At the end of this guide, you will have successfully built an Android `.apk` file that you can install on your Android device or submit to the Google Play store.\n\nWe'll cover development and production builds in this guide.\n\n* Start building for [development](#development-builds)\n* Start building for [production](#production-builds)\n* Building with [crosswalk](#building-with-crosswalk)\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Development Builds\"\n}\n[/block]\n## Queue the build\n\nTo start a development build of your app for Android, you can use the `ionic package build` command with the `android` platform type:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ ionic package build android\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nRunning that will bundle up your app and send it to our servers, where it will be sent into a build queue. This is important to know, because it means that your app is not built at the exact moment you run the command.\n\nYou should see some output like:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/vZeFQGMnSwiu2HWDNPnb_Screen%20Shot%202015-10-09%20at%203.40.03%20PM.png\",\n        \"Screen Shot 2015-10-09 at 3.40.03 PM.png\",\n        \"626\",\n        \"105\",\n        \"#349b22\",\n        \"\"\n      ],\n      \"caption\": \"Each time you run build you will be assigned a Build ID.\"\n    }\n  ]\n}\n[/block]\nTake note of the Build ID that your build is assigned. You'll reference this in other package commands.\n\n## Check the status\n\nOnce you have queued the build, you can check the status of your build by using the following command:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ ionic package list\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nYou should see a list of your latest builds, including the current **status** of that build.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/TWqrYEQkRvOW21tuoNxe_Screen%20Shot%202015-10-09%20at%203.38.26%20PM.png\",\n        \"Screen Shot 2015-10-09 at 3.38.26 PM.png\",\n        \"623\",\n        \"202\",\n        \"#7c9627\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nYou can alternatively see output for your exact build by running:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"# make sure to replace BUILD_ID with the ID your build was assigned\\n$ ionic package info BUILD_ID\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n## Be patient...\n\nNow you need to wait... \n\nBecause this is in an alpha state, and we don't know how often you'll want to run builds or how large they will be, we're still fine-tuning the systems that produce the builds behind the scenes. Your build could be done in a few seconds, or it could take 30 minutes. \n\nTo get this in your hands as soon as possible, we have left out a notification system to let you know when your builds are complete (don't worry, we're definitely going to have one), but for now, you'll just need to keep checking the status of your build until you see it has failed or succeeded. \n\n## What to do when your build fails\n\nIf your build fails, you can get more information about the failure by running the info command:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"# make sure to replace the BUILD_ID with the build id you were assigned\\n$ ionic package info BUILD_ID\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nThis may give you some information you can use to fix the build on your own, but if you get stuck or you're just not sure what's wrong, feel free to reach us in our [Gitter.im](http://gitter.im/driftyco/ionic-io-testers) room.\n\n## Downloading your build\n\nOkay, so you've waited patiently and your build status finally shows **success**...what now?\n\nWell that's pretty much it. All that's left to do is download the APK file we produced for you. You can do that by running:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"# make sure to replace BUILD_ID with the build id you were assigned\\n$ ionic package download BUILD_ID\\n\\n# you can optionally specify a download folder\\n$ ionic package download BUILD_ID -d /folder/to/place/your/apk\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nThis will download a file named `APP_NAME.apk`, where `APP_NAME` is the name listed in your `package.json` file.\n[block:callout]\n{\n  \"type\": \"success\",\n  \"title\": \"Success!\",\n  \"body\": \"You've now successfully built and downloaded a development build your of Android app.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Production Builds\"\n}\n[/block]\n## Queue the build\n\nTo start a production build of your app for Android, you can use the `ionic package build` command with the `android` platform type and a `--release` flag. \n\nBut before we dive into that command, we first need to talk about [Security Profiles](doc:security-profiles). Security Profiles are our way of securely storing your sensitive Android credentials in a way that allows you to reference them for your builds with a simple name.\n\nBefore you can actually queue a production build, you'll need to prepare a security profile with a valid Android Keystore. Head over to the [Android Credentials](doc:security-profiles#android-credentials) docs to learn how to create a Keystore that you can tie to a [Security Profile](doc:security-profiles) for your app.\n\nOnce you've got a profile with a Keystore attached, we can move on to actually queuing a build:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ ionic package build android --release --profile PROFILE_TAG\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Security Profile Tag\",\n  \"body\": \"You'll notice in the above command that we have passed `PROFILE_TAG`. You should replace this with the tag that was assigned to the security profile you created. You can find the tag by running:\\n\\n$ ionic security profiles list\"\n}\n[/block]\nThe rest of the process is identical to the [Android development build](doc:package-android) instructions, so please refer to those instructions if you haven't already gone through them.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Building with Crosswalk\"\n}\n[/block]\nIn order to build with Crosswalk support, you'll need to make sure that you've added crosswalk using `ionic plugin`. Many of you will have used `ionic browser` and unfortunately it does not currently set the proper information for the Package service. \n\nNever fear though, though can easily make sure you've got crosswalk setup correctly by running the following commands:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ ionic plugin rm cordova-plugin-crosswalk-webview\\n$ ionic plugin add cordova-plugin-crosswalk-webview\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nCheck out the [crosswalk docs](https://github.com/crosswalk-project/cordova-plugin-crosswalk-webview#configure) if you need to specify a specific version to use.","excerpt":"Guide to packaging for Android","slug":"package-android","type":"basic","title":"Android"}

Android

Guide to packaging for Android

Let's walk through generating a Package build for Android. At the end of this guide, you will have successfully built an Android `.apk` file that you can install on your Android device or submit to the Google Play store. We'll cover development and production builds in this guide. * Start building for [development](#development-builds) * Start building for [production](#production-builds) * Building with [crosswalk](#building-with-crosswalk) [block:api-header] { "type": "basic", "title": "Development Builds" } [/block] ## Queue the build To start a development build of your app for Android, you can use the `ionic package build` command with the `android` platform type: [block:code] { "codes": [ { "code": "$ ionic package build android", "language": "shell" } ] } [/block] Running that will bundle up your app and send it to our servers, where it will be sent into a build queue. This is important to know, because it means that your app is not built at the exact moment you run the command. You should see some output like: [block:image] { "images": [ { "image": [ "https://files.readme.io/vZeFQGMnSwiu2HWDNPnb_Screen%20Shot%202015-10-09%20at%203.40.03%20PM.png", "Screen Shot 2015-10-09 at 3.40.03 PM.png", "626", "105", "#349b22", "" ], "caption": "Each time you run build you will be assigned a Build ID." } ] } [/block] Take note of the Build ID that your build is assigned. You'll reference this in other package commands. ## Check the status Once you have queued the build, you can check the status of your build by using the following command: [block:code] { "codes": [ { "code": "$ ionic package list", "language": "shell" } ] } [/block] You should see a list of your latest builds, including the current **status** of that build. [block:image] { "images": [ { "image": [ "https://files.readme.io/TWqrYEQkRvOW21tuoNxe_Screen%20Shot%202015-10-09%20at%203.38.26%20PM.png", "Screen Shot 2015-10-09 at 3.38.26 PM.png", "623", "202", "#7c9627", "" ] } ] } [/block] You can alternatively see output for your exact build by running: [block:code] { "codes": [ { "code": "# make sure to replace BUILD_ID with the ID your build was assigned\n$ ionic package info BUILD_ID", "language": "shell" } ] } [/block] ## Be patient... Now you need to wait... Because this is in an alpha state, and we don't know how often you'll want to run builds or how large they will be, we're still fine-tuning the systems that produce the builds behind the scenes. Your build could be done in a few seconds, or it could take 30 minutes. To get this in your hands as soon as possible, we have left out a notification system to let you know when your builds are complete (don't worry, we're definitely going to have one), but for now, you'll just need to keep checking the status of your build until you see it has failed or succeeded. ## What to do when your build fails If your build fails, you can get more information about the failure by running the info command: [block:code] { "codes": [ { "code": "# make sure to replace the BUILD_ID with the build id you were assigned\n$ ionic package info BUILD_ID", "language": "shell" } ] } [/block] This may give you some information you can use to fix the build on your own, but if you get stuck or you're just not sure what's wrong, feel free to reach us in our [Gitter.im](http://gitter.im/driftyco/ionic-io-testers) room. ## Downloading your build Okay, so you've waited patiently and your build status finally shows **success**...what now? Well that's pretty much it. All that's left to do is download the APK file we produced for you. You can do that by running: [block:code] { "codes": [ { "code": "# make sure to replace BUILD_ID with the build id you were assigned\n$ ionic package download BUILD_ID\n\n# you can optionally specify a download folder\n$ ionic package download BUILD_ID -d /folder/to/place/your/apk", "language": "shell" } ] } [/block] This will download a file named `APP_NAME.apk`, where `APP_NAME` is the name listed in your `package.json` file. [block:callout] { "type": "success", "title": "Success!", "body": "You've now successfully built and downloaded a development build your of Android app." } [/block] [block:api-header] { "type": "basic", "title": "Production Builds" } [/block] ## Queue the build To start a production build of your app for Android, you can use the `ionic package build` command with the `android` platform type and a `--release` flag. But before we dive into that command, we first need to talk about [Security Profiles](doc:security-profiles). Security Profiles are our way of securely storing your sensitive Android credentials in a way that allows you to reference them for your builds with a simple name. Before you can actually queue a production build, you'll need to prepare a security profile with a valid Android Keystore. Head over to the [Android Credentials](doc:security-profiles#android-credentials) docs to learn how to create a Keystore that you can tie to a [Security Profile](doc:security-profiles) for your app. Once you've got a profile with a Keystore attached, we can move on to actually queuing a build: [block:code] { "codes": [ { "code": "$ ionic package build android --release --profile PROFILE_TAG", "language": "shell" } ] } [/block] [block:callout] { "type": "info", "title": "Security Profile Tag", "body": "You'll notice in the above command that we have passed `PROFILE_TAG`. You should replace this with the tag that was assigned to the security profile you created. You can find the tag by running:\n\n$ ionic security profiles list" } [/block] The rest of the process is identical to the [Android development build](doc:package-android) instructions, so please refer to those instructions if you haven't already gone through them. [block:api-header] { "type": "basic", "title": "Building with Crosswalk" } [/block] In order to build with Crosswalk support, you'll need to make sure that you've added crosswalk using `ionic plugin`. Many of you will have used `ionic browser` and unfortunately it does not currently set the proper information for the Package service. Never fear though, though can easily make sure you've got crosswalk setup correctly by running the following commands: [block:code] { "codes": [ { "code": "$ ionic plugin rm cordova-plugin-crosswalk-webview\n$ ionic plugin add cordova-plugin-crosswalk-webview", "language": "shell" } ] } [/block] Check out the [crosswalk docs](https://github.com/crosswalk-project/cordova-plugin-crosswalk-webview#configure) if you need to specify a specific version to use.