2

I am using a open source project but I want to change the name of the package so I can launch it to google play so my friends and family to try out as I am learning Computer Science in High School. I modified the app but when publishing it says I cannot do this as this package already exist and need a new one.

Any idea how to do that in android studio and do I need to delete the old package before I renamed it ?

  • The owner says 'I have done it before to release the new version. You need to refactor the folder structure from your ide, change the package statement at the top of all the java files and change the package name in the android manifest and the gradle build files.' – ashiqur Stark May 05 '15 at 18:06
  • When I rename it creates another package but the old one stays as I thought it will just rename the file ? There is 4 folder inside com. so which one do I change – ashiqur Stark May 05 '15 at 18:08

1 Answers1

0

Right click on the package name > Refactor > Rename. Or you can also select the package you want to rename and press Shift + F6

Agilanbu
  • 2,747
  • 2
  • 28
  • 33
Nike Sprite
  • 476
  • 2
  • 16
  • I done your way but the file are copied just the name changed but not the information com.likn.android.twitter. Do I have to change it manually or did I just do something wrong? – ashiqur Stark May 05 '15 at 18:57
  • do not change it manually or you will get in troubles, change it in Android Studio itself and try to publish your app again. – Nike Sprite May 05 '15 at 19:22
  • I am trying! I am just confused and I have to launch this app before June. Will you be able to give me some screenshot step by step or here step by step because your method the app had 201 error – ashiqur Stark May 05 '15 at 19:59
  • Maybe this will help you ? https://www.youtube.com/watch?v=A-rITYZQj0A Btw, before you try something, take a backup of your file – Nike Sprite May 05 '15 at 20:06
  • The developer of this open source says; Those folders are the package. You can change any of the com klinker android twitter folders and it will be reflected in your package name. So changing the com to org would give you the package org.klinker.android.twitter. Then change the java files, gradle files, and manifest files until you don't have any more errors on the build. Android studio tells you exactly where the problems are. -- What does he mean by that? – ashiqur Stark May 05 '15 at 20:55
  • In Android Studio, there's one folder named Manifest which has one file inside it. Open the file and change the package name as well in this Manifest.xml file. The package name of the java files will change automatically if you change the package name of the top-level folder. So just click SHIFT + F6 on top-folder (com.klinker.android.twitter) and rename it to the name that you want to use. – Nike Sprite May 05 '15 at 21:35
  • So I need to change androidmanifest.xml ? Java file contains com then klinder then android then twitter so which one is top-level folder? Do you have an email address I can email you the screenshot of the project file and find a solution? – ashiqur Stark May 05 '15 at 22:00
  • upload your picture using http://prntscr.com – Nike Sprite May 05 '15 at 22:24
  • Hey here the screenshot http://prntscr.com/727amu. – ashiqur Stark May 06 '15 at 15:13
  • try to build your gradle files first http://prntscr.com/727eft – Nike Sprite May 06 '15 at 15:21
  • Done! What shall I do next ? – ashiqur Stark May 06 '15 at 16:03
  • I have done this step! What shall I do next upon your view after looking at the screenshot? – ashiqur Stark May 06 '15 at 17:10
  • Try to change the package name 'com.klinker.android.twitter' to wathever you want by rightclicking on top-level folder (the first folder in Java) and Refactor > Rename. (Do all these things in android studio itself) – Nike Sprite May 06 '15 at 17:12
  • I understand what you mean but this is not in the package file any other way to do ? – ashiqur Stark May 06 '15 at 19:19