{"id":231,"date":"2016-02-17T20:40:26","date_gmt":"2016-02-17T20:40:26","guid":{"rendered":"http:\/\/fluentreports.com\/blog\/?p=231"},"modified":"2016-02-21T08:05:43","modified_gmt":"2016-02-21T08:05:43","slug":"nativescript-upgrading-to-v1-60","status":"publish","type":"post","link":"https:\/\/fluentreports.com\/blog\/?p=231","title":{"rendered":"NativeScript: Upgrading to v1.60"},"content":{"rendered":"<p>Since I have been posting these since the early versions of NativeScript; I figured I would continue.\u00a0\u00a0 It has been several months since the last major upgrade and this version has all sorts of bug fixes and new goodies.\u00a0\u00a0 The changelog is available at <a href=\"https:\/\/github.com\/NativeScript\/NativeScript\/releases\/tag\/v1.6.0\">https:\/\/github.com\/NativeScript\/NativeScript\/releases\/tag\/v1.6.0<\/a><\/p>\n<p>Some of the new features that I'm looking forward to trying out is new percentage(%) width\/height code.\u00a0\u00a0 This should allow us to build even better screens.\u00a0 And the massively upgraded CSS selector code which now allows CSS selectors like we use on the web.<\/p>\n<p>1. <strong>npm install -g nativescript<\/strong><br \/>\nif you now look at your <strong>nativescript --version<\/strong> you should have a nice v1.6.0 show up.\u00a0 You only have to do this one time.<\/p>\n<p>2. <strong>npm install tns-core-modules@latest --save<\/strong><br \/>\nWhat, that is it to install all the new core modules?\u00a0 WooHoo, so simple! \u00a0 Make sure you do this on EACH of your projects!<\/p>\n<p>3. <strong>tns platform remove android<\/strong> AND\/OR <strong>tns platform remove ios<\/strong><br \/>\nPlease note before you run the above commands if you have made ANY changes to the xcode project, plists or the Android manifest; you might want to back them up first, or you will have to manually make those changes again.\u00a0 Again this has to be done for EACH of your projects...<\/p>\n<p>4. <strong>tns platform add android<\/strong> AND\/OR <strong>tns platform add ios<\/strong><br \/>\nThis also needs to be done for each project.\u00a0 You can do a <em>type package.json<\/em> or <em>cat package.json<\/em> and you should see everything say \"1.6.0\"<\/p>\n<p>Again a big Kudos for the teams involved in making the updated from v1.3 onward so seamless; if you look at my prior upgrade posts you can see how much EASIER it is to upgrade now.<\/p>\n<p>Tow Gotcha's on Android: when you convert to v1.6.0 (I assume they will fix it in 1.6.1), if you get a \"Unhandled Exception -- Java.lang.RuntimeException: Unable to create application\" when your app starts.\u00a0 The easy solution for this that involves fixing your app.js file; as you probably have something attempting to get the application context.\u00a0\u00a0 The simple solution is to rewrite your app.js file to be:<br \/>\n<pre>var application = require(&quot;application&quot;);\nif (global.android) {\n&nbsp;&nbsp;&nbsp;&nbsp;application.start({moduleName: &quot;main-page&quot;});\n}\n\n\/\/ All your custom initialization code \n\/\/ including any additional require statements...\n\nif (!global.android) {\n&nbsp;&nbsp;&nbsp;&nbsp;application.start({moduleName: &quot;main-page&quot;});\n}<\/pre><br \/>\nSecond gotcha, DO NOT USE <strong>clearHistory: true<\/strong> in any of your navigation calls, this will corrupt the navigation and cause some majorly WEIRD issues.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Since I have been posting these since the early versions of NativeScript; I figured I would continue.\u00a0\u00a0 It has been several months since the last major upgrade and this version has all sorts of bug fixes and new goodies.\u00a0\u00a0 The changelog is available at https:\/\/github.com\/NativeScript\/NativeScript\/releases\/tag\/v1.6.0 Some of the new features that I'm looking forward to&hellip; <a class=\"more-link\" href=\"https:\/\/fluentreports.com\/blog\/?p=231\">Continue reading <span class=\"screen-reader-text\">NativeScript: Upgrading to v1.60<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[15,39],"tags":[54,16],"class_list":["post-231","post","type-post","status-publish","format-standard","hentry","category-nativescript","category-tips","tag-n","tag-nativescript","entry"],"_links":{"self":[{"href":"https:\/\/fluentreports.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/231","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fluentreports.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fluentreports.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fluentreports.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fluentreports.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=231"}],"version-history":[{"count":4,"href":"https:\/\/fluentreports.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/231\/revisions"}],"predecessor-version":[{"id":253,"href":"https:\/\/fluentreports.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/231\/revisions\/253"}],"wp:attachment":[{"href":"https:\/\/fluentreports.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=231"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fluentreports.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=231"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fluentreports.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=231"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}