{"id":588,"date":"2015-07-24T16:01:28","date_gmt":"2015-07-24T11:01:28","guid":{"rendered":"http:\/\/www.stonemillkids.com\/?p=588"},"modified":"2016-09-01T21:26:53","modified_gmt":"2016-09-01T16:26:53","slug":"renaming-moving-an-existing-project-in-the-andriod-sdk","status":"publish","type":"post","link":"http:\/\/www.stonemillkids.com\/index.php\/2015\/07\/24\/renaming-moving-an-existing-project-in-the-andriod-sdk\/","title":{"rendered":"Renaming \/ Moving an Existing Project in the Andriod SDK"},"content":{"rendered":"<h1>Problem:<\/h1>\n<p>My current App is called &#8220;Shapes!&#8221;\u00a0 but I want to change it to something like &#8220;Bubbles&#8221;.<\/p>\n<h1>Solution:<\/h1>\n<p>Move and Rename ALL of the files with a reference to &#8220;Shapes.&#8221;\u00a0 This ended up being more complex than I thought because I wanted to keep my git history.\u00a0 Because of this, I will first post what I did inside the Android SDK.\u00a0 Note, it you are using git, or other Source control, then you will need to do this equivalent moving with your VCS.<\/p>\n<p style=\"padding-left: 60px;\"><em>Personally I first checked out a new project and did\u00a0all of the steps below in a clean checkout.\u00a0 I committed all of the changes locally.\u00a0 Second, I checked out a 2nd copy of the project to a new directory, then manually made all of the file moves before I then copied the contents\u00a0first project to the second.\u00a0 Finally, when everything compiled in the 2nd copy, I pushed it back to the server.<\/em><\/p>\n<h3>Steps for the Android SDK<\/h3>\n<p>In each of the steps below I am simply replacing the word &#8220;Shapes&#8221; with &#8220;BubbleDeluxe&#8221;<\/p>\n<p>&nbsp;<\/p>\n<p>1) Rename the Game class inside the Android SDK using Refactor (Shift+F6)<\/p>\n<pre style=\"color: #000000; padding-left: 30px; font-family: 'Courier New'; font-size: 9pt; background-color: #ffffff;\">public class BubbleDeluxe extends Game {<\/pre>\n<p>2) Rename the package in the package explorer using Refactor\u00a0(Shift+F6)<\/p>\n<pre style=\"color: #000000; padding-left: 30px; font-family: 'Courier New'; font-size: 9pt; background-color: #ffffff;\">package com.stonemill.bubble;<\/pre>\n<p>3) Manually rename the package in Android Manifest.xml<\/p>\n<pre style=\"color: #000000; padding-left: 30px; font-family: 'Courier New'; font-size: 9pt; background-color: #ffffff;\">package=\"com.stonemill.bubble.android\"<\/pre>\n<p>4) Manually rename the App Name in srcandroidresvaluesstrings.xml<\/p>\n<pre style=\"color: #000000; padding-left: 30px; font-family: 'Courier New'; font-size: 9pt; background-color: #ffffff;\">&lt;string name=\"app_name\"&gt;Bubble Deluxe&lt;\/string&gt;\r\n<\/pre>\n<p>5) Shapes.gwt.xml &#8211; Manually rename the file and the app name<\/p>\n<pre style=\"color: #000000; padding-left: 30px; font-family: 'Courier New'; font-size: 9pt; background-color: #ffffff;\">&lt;source path=\"com\/stonemill\/bubble\" \/&gt;<\/pre>\n<p>6) Manually change the build.gradle script<\/p>\n<pre style=\"color: #000000; padding-left: 30px; font-family: 'Courier New'; font-size: 9pt; background-color: #ffffff;\">commandLine \"$adb\", 'shell', 'am', 'start', '-n', 'com.stonemill.bubble.android\/AndroidLauncher'<\/pre>\n<p>7) Exit Android Studio<br \/>\n8) Delete the 4 directories<\/p>\n<ul>\n<li>Build<\/li>\n<li>.idea<\/li>\n<li>.gradle<\/li>\n<li>gradle<\/li>\n<\/ul>\n<p style=\"padding-left: 30px;\">Here is a link to a good <a href=\"http:\/\/stackoverflow.com\/questions\/16977739\/how-to-add-gradle-backing-to-existing-project\" target=\"_blank\">post <\/a>on this step.\u00a0 While the question may not be exactly on point, many of the answers go into a lot of detail on synchronizing gradle and the Android SDK.<\/p>\n<p>9) Return to the SDK<\/p>\n<p>10) Choose &#8211; Open and Existing Prodject<\/p>\n<p>11) Choose &#8211; Use Defaut Gradle Wrapper<\/p>\n<p>12) Launch the Desktop Launcher (it will fail)<\/p>\n<p style=\"padding-left: 30px;\">a. Go into the Run Configurations and change the Desktop Launcher to user the android assets directory<\/p>\n<p style=\"padding-left: 60px;\">Bubblessrcandroidassets<\/p>\n<p style=\"padding-left: 30px;\">b. Rebuild the desktop application<\/p>\n<p><strong>Success!<\/strong><\/p>\n<p>&nbsp;<\/p>\n<h3>Change Log from my git Push<\/h3>\n<p>I use GitLab as my code repository, ticketing system, and code review repository.\u00a0 On Windows I am still using TortoiseGit.\u00a0 As such, I found this link to help explain how to move files.<\/p>\n<p><a href=\"http:\/\/tortoisegit.org\/docs\/tortoisegit\/tgit-dug-rename.html\" target=\"_blank\">http:\/\/tortoisegit.org\/docs\/tortoisegit\/tgit-dug-rename.html<\/a><\/p>\n<p>Below are all of the files that ended up changing.\u00a0 I only have 5 files that I coded as part of the game.\u00a0 Everything else is part of the LibGDX framework.\u00a0\u00a0My files\u00a0in are in the folder.<\/p>\n<div class=\"file-stats js-toggle-content hide\">com.stonemill.bubble<\/div>\n<pre style=\"padding-left: 30px;\">src\/core\/src\/com\/stonemill\/bubble\/AbstractScreen.java\r\nsrc\/core\/src\/com\/stonemill\/bubble\/Bubble.java\r\nsrc\/core\/src\/com\/stonemill\/bubble\/BubbleDeluxe.java\r\nsrc\/core\/src\/com\/stonemill\/bubble\/LevelScreen.java\r\nsrc\/core\/src\/com\/stonemill\/bubble\/Settings.java\r\n\r\n<\/pre>\n<div class=\"btn-group\">\n<p>Change log:<\/p>\n<pre><strong>Showing 23 changed files with 89 additions and 90 deletions<\/strong>\r\nsrc\/android\/AndroidManifest.xml\r\nsrc\/android\/build.gradle\r\nsrc\/android\/res\/values\/strings.xml\r\nsrc\/android\/src\/com\/stonemill\/bubble\/android\/AndroidLauncher.java\r\nsrc\/build.gradle\r\nsrc\/core\/src\/Shapes.gwt.xml\r\nsrc\/core\/src\/com\/stonemill\/bubble\/AbstractScreen.java\r\nsrc\/core\/src\/com\/stonemill\/bubble\/Bubble.java\r\nsrc\/core\/src\/com\/stonemill\/bubble\/BubbleDeluxe.java\r\nsrc\/core\/src\/com\/stonemill\/bubble\/LevelScreen.java\r\nsrc\/core\/src\/com\/stonemill\/bubble\/Settings.java\r\nsrc\/desktop\/build.gradle\r\nsrc\/desktop\/src\/com\/stonemill\/bubble\/desktop\/DesktopLauncher.java\r\nsrc\/gradle\/wrapper\/gradle-wrapper.jar\r\nsrc\/gradle\/wrapper\/gradle-wrapper.properties\r\nsrc\/html\/build.gradle\r\nsrc\/html\/webapp\/index.html\r\nsrc\/html\/src\/com\/stonemill\/bubble\/GdxDefinition.gwt.xml\r\nsrc\/html\/src\/com\/stonemill\/bubble\/GdxDefinitionSuperdev.gwt.xml\r\nsrc\/html\/src\/com\/stonemill\/bubble\/client\/HtmlLauncher.java\r\nsrc\/ios\/build.gradle\r\nsrc\/ios\/robovm.properties\r\nsrc\/ios\/src\/com\/stonemill\/bubble\/IOSLauncher.java\r\n<\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Problem: My current App is called &#8220;Shapes!&#8221;\u00a0 but I want to change it to something like &#8220;Bubbles&#8221;. Solution: Move and Rename ALL of the files with a reference to &#8220;Shapes.&#8221;\u00a0 This ended up being more complex than I thought because I wanted to keep my git history.\u00a0 Because of this, I will first post what [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":421,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[20,14,12],"tags":[37,43,42,31],"_links":{"self":[{"href":"http:\/\/www.stonemillkids.com\/index.php\/wp-json\/wp\/v2\/posts\/588"}],"collection":[{"href":"http:\/\/www.stonemillkids.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.stonemillkids.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.stonemillkids.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.stonemillkids.com\/index.php\/wp-json\/wp\/v2\/comments?post=588"}],"version-history":[{"count":2,"href":"http:\/\/www.stonemillkids.com\/index.php\/wp-json\/wp\/v2\/posts\/588\/revisions"}],"predecessor-version":[{"id":778,"href":"http:\/\/www.stonemillkids.com\/index.php\/wp-json\/wp\/v2\/posts\/588\/revisions\/778"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.stonemillkids.com\/index.php\/wp-json\/wp\/v2\/media\/421"}],"wp:attachment":[{"href":"http:\/\/www.stonemillkids.com\/index.php\/wp-json\/wp\/v2\/media?parent=588"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.stonemillkids.com\/index.php\/wp-json\/wp\/v2\/categories?post=588"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.stonemillkids.com\/index.php\/wp-json\/wp\/v2\/tags?post=588"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}