52

I have made an app and it is my very first app so when I started coding, I left the package name as com.example.stuff and now when I try to upload to the play store it wont let me due to the package name. I have tried refactor-> rename the package name and changed it in the AndroidManifst.xml then I tried to upload again. I am once again left with the same message time after time.

I appreciate any help and thanks in advance. :)

Thaej Sooriya
  • 519
  • 1
  • 4
  • 4
  • 3
    Yes, but none of the answers there worked for me. Sometimes I think it's good to post a question a second time because people come with newer solutions. Or what is the normal practice here to ask people "Hey, I now in thread xyz the quetion was already askes. But the answers didn't help me. So may someone have a modern solution for this problem?"? – unlimited101 Nov 19 '15 at 08:17
  • The problem with this issue is that, IMO, all of the answers given are partial solutions. I have never seen an answer to this question that changes the package name everywhere. – Dean Blakely Dec 26 '15 at 22:52

3 Answers3

76

First click once on your package and then click setting icon on Android Studio.

Close/Unselect Compact Empty Middle Packages

Then, right click your package and rename it.

Thats all.

enter image description here

Mehmet
  • 3,301
  • 8
  • 26
  • 36
  • Also, this video explain how solve your problem [http://www.youtube.com/watch?v=RNcrzOMugn8](http://www.youtube.com/watch?v=RNcrzOMugn8) – Mehmet Dec 28 '14 at 13:53
  • 2
    Btw dont forget rebuild your application after make your changes. **Build>Rebuild App** – Mehmet Dec 28 '14 at 14:03
  • 1
    Just want to add, that is need to go to build.gradle (of the module) and change ApplicationID to – Shudy Jun 06 '16 at 10:40
  • This is the perfect, accurate, appropriate, standard, best, amazing and proper way. Dot. – sandhya sasane Apr 30 '18 at 06:07
54

In projects that use the Gradle build system, what you want to change is the applicationId in the build.gradle file. The build system uses this value to override anything specified by hand in the manifest file when it does the manifest merge and build.

For example, your module's build.gradle file looks something like this:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 20
    buildToolsVersion "20.0.0"

    defaultConfig {
        // CHANGE THE APPLICATION ID BELOW
        applicationId "com.example.fred.myapplication"
        minSdkVersion 10
        targetSdkVersion 20
        versionCode 1
        versionName "1.0"
    }
}

applicationId is the name the build system uses for the property that eventually gets written to the package attribute of the manifest tag in the manifest file. It was renamed to prevent confusion with the Java package name (which you have also tried to modify), which has nothing to do with it.

Scott Barta
  • 79,344
  • 24
  • 180
  • 163
28

It can be done very easily in one step. You don't have to touch AndroidManifest. Instead do the following:

  1. right click on the root folder of your project.
  2. Click "Open Module Setting".
  3. Go to the Flavours tab.
  4. Change the applicationID to whatever package name you want. Press OK.
Moj
  • 2,872
  • 1
  • 13
  • 9