{"id":3354,"date":"2017-08-28T12:17:21","date_gmt":"2017-08-28T10:17:21","guid":{"rendered":"http:\/\/www.benoitfreslon.com\/?p=3354"},"modified":"2024-07-19T09:28:35","modified_gmt":"2024-07-19T07:28:35","slug":"unity-install-and-run-an-apk-on-all-connected-devices-with-a-bash-script-on-os-x","status":"publish","type":"post","link":"https:\/\/benoitfreslon.com\/fr\/news\/unity-install-and-run-an-apk-on-all-connected-devices-with-a-bash-script-on-os-x\/","title":{"rendered":"Unity &#8211; Install and run an APK on all connected devices with a bash script on OS X"},"content":{"rendered":"<p class=\"qtranxs-available-languages-message qtranxs-available-languages-message-fr\">D\u00e9sol\u00e9, cet article est seulement disponible en <a href=\"https:\/\/benoitfreslon.com\/en\/wp-json\/wp\/v2\/posts\/3354\" class=\"qtranxs-available-language-link qtranxs-available-language-link-en\" title=\"English\">English<\/a>.<\/p><p>Hey,<\/p>\n<p>As a mobile game developer you need to deploy your game on multiple devices, especially on Android devices.<\/p>\n<p>Unity can only Build and run on ONE device.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3356\" src=\"https:\/\/benoitfreslon.com\/wp-content\/uploads\/2017\/08\/unity-build.png\" alt=\"\" width=\"265\" height=\"68\" \/><\/p>\n<p>If you connect several devices the build will be run on one device only.<\/p>\n<p>So if you want to install and run an .apk file on all connected devices you can use this script:<\/p>\n<ul>\n<li>Create a file named <strong>push_apk_all_devices.sh<\/strong><\/li>\n<li>Copy and paste this script:<\/li>\n<\/ul>\n<pre class=\"lang:sh decode:true\" title=\"push_apk_all_devices.sh\">#!\/bin\/bash\r\n\r\n# 1. Set up these constants\r\n# 2. Launch the Shell script with: \"sh push_apk_all_devices.sh\" in a terminal window\r\n\r\nAPK_PATH='\/Users\/Path\/MyGame.apk'\r\nBUNDLE_ID='com.domain.appname'\r\nMAIN_ACTIVITY='com.unity3d.player.UnityPlayerActivity'\r\n\r\n\r\necho \"APK_PATH: $APK_PATH\"\r\necho \"BUNDLE_ID: $BUNDLE_ID\"\r\necho \"MAIN_ACTIVITY: $MAIN_ACTIVITY\"\r\n\r\ninstall_to_device() {\r\n  local prettyName=$(adb -s $1 shell getprop ro.product.model)\r\n  echo \"\r\n  Starting Installatroning on $prettyName\"\r\n  adb -s $1 install -r \"${APK_PATH}\"\r\n  adb -s $1 shell am start -n \"${BUNDLE_ID}\/${MAIN_ACTIVITY}\"\r\n  adb -s $1 shell input keyevent KEYCODE_WAKEUP\r\n  echo \"------&gt; Installatron completed on $prettyName\"\r\n}\r\necho \"----------------------- INSTALLATION-------------------------\"\r\n\r\nadb devices -l\r\n\r\nfor SERIAL in $(adb devices | tail -n +2 | cut -sf 1);\r\ndo \r\n  install_to_device $SERIAL&amp;\r\ndone\r\n\r\nexit<\/pre>\n<ul>\n<li>First, you need to install the <a href=\"https:\/\/developer.android.com\/studio\/index.html\">Android SDK<\/a><\/li>\n<li>Open a Terminal window<\/li>\n<li>Type\u00a0<strong>adb<\/strong>\u00a0and Press enter in order to check if the adb command is installed<\/li>\n<\/ul>\n<pre class=\"lang:sh decode:true\">MacBook-Pro-de-Benoit-2:~ Benoit$ adb\r\nAndroid Debug Bridge version 1.0.39\r\nRevision 3db08f2c6889-android\r\nInstalled as \/Users\/Benoit\/Library\/Android\/sdk\/platform-tools\/adb<\/pre>\n<ul>\n<li>Check if the devices are connected and type <strong>adb devices<\/strong><\/li>\n<\/ul>\n<pre class=\"lang:sh decode:true\">MacBook-Pro-de-Benoit-2:~ Benoit$ adb devices\r\nList of devices attached\r\nTA39502ZNO\tdevice\r\n05dedc95146756a1\tdevice<\/pre>\n<ul>\n<li>Build an .apk file with Unity<\/li>\n<li>Then launch this script:<strong> sh<\/strong>\u00a0<strong>path\/push_apk_all_devices.sh<\/strong> (just drag and drop the script in the\u00a0terminal window)<\/li>\n<li>When it&rsquo;s done press CTRL + C to stop the script.<\/li>\n<\/ul>\n<p>SOURCE:\u00a0<a href=\"https:\/\/stackoverflow.com\/questions\/8610733\/how-can-i-adb-install-an-apk-to-multiple-connected-devices\/14822827\">https:\/\/stackoverflow.com\/questions\/8610733\/how-can-i-adb-install-an-apk-to-multiple-connected-devices\/14822827<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>D\u00e9sol\u00e9, cet article est seulement disponible en English.Hey, As a mobile game developer you need to deploy your game on&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1,390],"tags":[326,306,327,328,329,270],"class_list":["post-3354","post","type-post","status-publish","format-standard","hentry","category-news","category-tutorial","tag-adb","tag-android","tag-devices","tag-export","tag-run","tag-unity","wpcat-1-id","wpcat-390-id"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Unity - Install and run an APK on all connected devices with a bash script on OS X - Beno\u00eet Freslon<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/benoitfreslon.com\/fr\/news\/unity-install-and-run-an-apk-on-all-connected-devices-with-a-bash-script-on-os-x\/\" \/>\n<meta name=\"twitter:label1\" content=\"\u00c9crit par\" \/>\n\t<meta name=\"twitter:data1\" content=\"Benoit Freslon\" \/>\n\t<meta name=\"twitter:label2\" content=\"Dur\u00e9e de lecture estim\u00e9e\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/benoitfreslon.com\\\/news\\\/unity-install-and-run-an-apk-on-all-connected-devices-with-a-bash-script-on-os-x\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/benoitfreslon.com\\\/news\\\/unity-install-and-run-an-apk-on-all-connected-devices-with-a-bash-script-on-os-x\\\/\"},\"author\":{\"name\":\"Benoit Freslon\",\"@id\":\"https:\\\/\\\/benoitfreslon.com\\\/#\\\/schema\\\/person\\\/fe9fe28a6b6c2b56648448b977fd6b78\"},\"headline\":\"Unity &#8211; Install and run an APK on all connected devices with a bash script on OS X\",\"datePublished\":\"2017-08-28T10:17:21+00:00\",\"dateModified\":\"2024-07-19T07:28:35+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/benoitfreslon.com\\\/news\\\/unity-install-and-run-an-apk-on-all-connected-devices-with-a-bash-script-on-os-x\\\/\"},\"wordCount\":176,\"image\":{\"@id\":\"https:\\\/\\\/benoitfreslon.com\\\/news\\\/unity-install-and-run-an-apk-on-all-connected-devices-with-a-bash-script-on-os-x\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/benoitfreslon.com\\\/wp-content\\\/uploads\\\/2017\\\/08\\\/unity-build.png\",\"keywords\":[\"adb\",\"Android\",\"devices\",\"export\",\"run\",\"unity\"],\"articleSection\":[\"Actualit\u00e9s\",\"Tutoriels\"],\"inLanguage\":\"fr-FR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/benoitfreslon.com\\\/fr\\\/news\\\/unity-install-and-run-an-apk-on-all-connected-devices-with-a-bash-script-on-os-x\\\/\",\"url\":\"https:\\\/\\\/benoitfreslon.com\\\/fr\\\/news\\\/unity-install-and-run-an-apk-on-all-connected-devices-with-a-bash-script-on-os-x\\\/\",\"name\":\"Unity - Install and run an APK on all connected devices with a bash script on OS X - Beno\u00eet Freslon\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/benoitfreslon.com\\\/fr\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/benoitfreslon.com\\\/fr\\\/news\\\/unity-install-and-run-an-apk-on-all-connected-devices-with-a-bash-script-on-os-x\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/benoitfreslon.com\\\/news\\\/unity-install-and-run-an-apk-on-all-connected-devices-with-a-bash-script-on-os-x\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/benoitfreslon.com\\\/wp-content\\\/uploads\\\/2017\\\/08\\\/unity-build.png\",\"datePublished\":\"2017-08-28T10:17:21+00:00\",\"dateModified\":\"2024-07-19T07:28:35+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/benoitfreslon.com\\\/#\\\/schema\\\/person\\\/fe9fe28a6b6c2b56648448b977fd6b78\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/benoitfreslon.com\\\/fr\\\/news\\\/unity-install-and-run-an-apk-on-all-connected-devices-with-a-bash-script-on-os-x\\\/#breadcrumb\"},\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[[\"https:\\\/\\\/benoitfreslon.com\\\/fr\\\/news\\\/unity-install-and-run-an-apk-on-all-connected-devices-with-a-bash-script-on-os-x\\\/\"]]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\\\/\\\/benoitfreslon.com\\\/fr\\\/news\\\/unity-install-and-run-an-apk-on-all-connected-devices-with-a-bash-script-on-os-x\\\/#primaryimage\",\"url\":\"https:\\\/\\\/benoitfreslon.com\\\/wp-content\\\/uploads\\\/2017\\\/08\\\/unity-build.png\",\"contentUrl\":\"https:\\\/\\\/benoitfreslon.com\\\/wp-content\\\/uploads\\\/2017\\\/08\\\/unity-build.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/benoitfreslon.com\\\/fr\\\/news\\\/unity-install-and-run-an-apk-on-all-connected-devices-with-a-bash-script-on-os-x\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/benoitfreslon.com\\\/fr\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Unity &#8211; Install and run an APK on all connected devices with a bash script on OS X\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/benoitfreslon.com\\\/fr\\\/#website\",\"url\":\"https:\\\/\\\/benoitfreslon.com\\\/fr\\\/\",\"name\":\"Beno\u00eet Freslon\",\"description\":\"[:en]Game designer | D\u00e9veloppeur de jeux ind\u00e9pendant | Freelance | Enseignant | Blogueur[:fr]Game designer | Independent game developer | Freelance | Teacher | Blogger[:]\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/benoitfreslon.com\\\/fr\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"fr-FR\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/benoitfreslon.com\\\/#\\\/schema\\\/person\\\/fe9fe28a6b6c2b56648448b977fd6b78\",\"name\":\"Benoit Freslon\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0b828da2527f91fb7c86dab67050492f4303279afa245d6e718ea1c6e6f00bb2?s=96&d=identicon&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0b828da2527f91fb7c86dab67050492f4303279afa245d6e718ea1c6e6f00bb2?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0b828da2527f91fb7c86dab67050492f4303279afa245d6e718ea1c6e6f00bb2?s=96&d=identicon&r=g\",\"caption\":\"Benoit Freslon\"},\"sameAs\":[\"https:\\\/\\\/benoitfreslon.com\",\"https:\\\/\\\/www.instagram.com\\\/benoitfreslon\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/benoitfreslon\",\"https:\\\/\\\/x.com\\\/BenoitFreslon\",\"https:\\\/\\\/www.youtube.com\\\/benoitfreslon\"],\"url\":\"https:\\\/\\\/benoitfreslon.com\\\/fr\\\/author\\\/admin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Unity - Install and run an APK on all connected devices with a bash script on OS X - Beno\u00eet Freslon","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/benoitfreslon.com\/fr\/news\/unity-install-and-run-an-apk-on-all-connected-devices-with-a-bash-script-on-os-x\/","twitter_misc":{"\u00c9crit par":"Benoit Freslon","Dur\u00e9e de lecture estim\u00e9e":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/benoitfreslon.com\/news\/unity-install-and-run-an-apk-on-all-connected-devices-with-a-bash-script-on-os-x\/#article","isPartOf":{"@id":"https:\/\/benoitfreslon.com\/news\/unity-install-and-run-an-apk-on-all-connected-devices-with-a-bash-script-on-os-x\/"},"author":{"name":"Benoit Freslon","@id":"https:\/\/benoitfreslon.com\/#\/schema\/person\/fe9fe28a6b6c2b56648448b977fd6b78"},"headline":"Unity &#8211; Install and run an APK on all connected devices with a bash script on OS X","datePublished":"2017-08-28T10:17:21+00:00","dateModified":"2024-07-19T07:28:35+00:00","mainEntityOfPage":{"@id":"https:\/\/benoitfreslon.com\/news\/unity-install-and-run-an-apk-on-all-connected-devices-with-a-bash-script-on-os-x\/"},"wordCount":176,"image":{"@id":"https:\/\/benoitfreslon.com\/news\/unity-install-and-run-an-apk-on-all-connected-devices-with-a-bash-script-on-os-x\/#primaryimage"},"thumbnailUrl":"https:\/\/benoitfreslon.com\/wp-content\/uploads\/2017\/08\/unity-build.png","keywords":["adb","Android","devices","export","run","unity"],"articleSection":["Actualit\u00e9s","Tutoriels"],"inLanguage":"fr-FR"},{"@type":"WebPage","@id":"https:\/\/benoitfreslon.com\/fr\/news\/unity-install-and-run-an-apk-on-all-connected-devices-with-a-bash-script-on-os-x\/","url":"https:\/\/benoitfreslon.com\/fr\/news\/unity-install-and-run-an-apk-on-all-connected-devices-with-a-bash-script-on-os-x\/","name":"Unity - Install and run an APK on all connected devices with a bash script on OS X - Beno\u00eet Freslon","isPartOf":{"@id":"https:\/\/benoitfreslon.com\/fr\/#website"},"primaryImageOfPage":{"@id":"https:\/\/benoitfreslon.com\/fr\/news\/unity-install-and-run-an-apk-on-all-connected-devices-with-a-bash-script-on-os-x\/#primaryimage"},"image":{"@id":"https:\/\/benoitfreslon.com\/news\/unity-install-and-run-an-apk-on-all-connected-devices-with-a-bash-script-on-os-x\/#primaryimage"},"thumbnailUrl":"https:\/\/benoitfreslon.com\/wp-content\/uploads\/2017\/08\/unity-build.png","datePublished":"2017-08-28T10:17:21+00:00","dateModified":"2024-07-19T07:28:35+00:00","author":{"@id":"https:\/\/benoitfreslon.com\/#\/schema\/person\/fe9fe28a6b6c2b56648448b977fd6b78"},"breadcrumb":{"@id":"https:\/\/benoitfreslon.com\/fr\/news\/unity-install-and-run-an-apk-on-all-connected-devices-with-a-bash-script-on-os-x\/#breadcrumb"},"inLanguage":"fr-FR","potentialAction":[{"@type":"ReadAction","target":[["https:\/\/benoitfreslon.com\/fr\/news\/unity-install-and-run-an-apk-on-all-connected-devices-with-a-bash-script-on-os-x\/"]]}]},{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/benoitfreslon.com\/fr\/news\/unity-install-and-run-an-apk-on-all-connected-devices-with-a-bash-script-on-os-x\/#primaryimage","url":"https:\/\/benoitfreslon.com\/wp-content\/uploads\/2017\/08\/unity-build.png","contentUrl":"https:\/\/benoitfreslon.com\/wp-content\/uploads\/2017\/08\/unity-build.png"},{"@type":"BreadcrumbList","@id":"https:\/\/benoitfreslon.com\/fr\/news\/unity-install-and-run-an-apk-on-all-connected-devices-with-a-bash-script-on-os-x\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/benoitfreslon.com\/fr\/"},{"@type":"ListItem","position":2,"name":"Unity &#8211; Install and run an APK on all connected devices with a bash script on OS X"}]},{"@type":"WebSite","@id":"https:\/\/benoitfreslon.com\/fr\/#website","url":"https:\/\/benoitfreslon.com\/fr\/","name":"Beno\u00eet Freslon","description":"[:en]Game designer | D\u00e9veloppeur de jeux ind\u00e9pendant | Freelance | Enseignant | Blogueur[:fr]Game designer | Independent game developer | Freelance | Teacher | Blogger[:]","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/benoitfreslon.com\/fr\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"fr-FR"},{"@type":"Person","@id":"https:\/\/benoitfreslon.com\/#\/schema\/person\/fe9fe28a6b6c2b56648448b977fd6b78","name":"Benoit Freslon","image":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/secure.gravatar.com\/avatar\/0b828da2527f91fb7c86dab67050492f4303279afa245d6e718ea1c6e6f00bb2?s=96&d=identicon&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/0b828da2527f91fb7c86dab67050492f4303279afa245d6e718ea1c6e6f00bb2?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0b828da2527f91fb7c86dab67050492f4303279afa245d6e718ea1c6e6f00bb2?s=96&d=identicon&r=g","caption":"Benoit Freslon"},"sameAs":["https:\/\/benoitfreslon.com","https:\/\/www.instagram.com\/benoitfreslon","https:\/\/www.linkedin.com\/in\/benoitfreslon","https:\/\/x.com\/BenoitFreslon","https:\/\/www.youtube.com\/benoitfreslon"],"url":"https:\/\/benoitfreslon.com\/fr\/author\/admin\/"}]}},"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/pLAe3-S6","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/benoitfreslon.com\/fr\/wp-json\/wp\/v2\/posts\/3354","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/benoitfreslon.com\/fr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/benoitfreslon.com\/fr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/benoitfreslon.com\/fr\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/benoitfreslon.com\/fr\/wp-json\/wp\/v2\/comments?post=3354"}],"version-history":[{"count":11,"href":"https:\/\/benoitfreslon.com\/fr\/wp-json\/wp\/v2\/posts\/3354\/revisions"}],"predecessor-version":[{"id":39081,"href":"https:\/\/benoitfreslon.com\/fr\/wp-json\/wp\/v2\/posts\/3354\/revisions\/39081"}],"wp:attachment":[{"href":"https:\/\/benoitfreslon.com\/fr\/wp-json\/wp\/v2\/media?parent=3354"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/benoitfreslon.com\/fr\/wp-json\/wp\/v2\/categories?post=3354"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/benoitfreslon.com\/fr\/wp-json\/wp\/v2\/tags?post=3354"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}