32

I am trying to upload my finished android app to the android market and I am getting this error:

You need to use a different package name because "com.example" is restricted.
matiash
  • 54,791
  • 16
  • 125
  • 154
Mike
  • 6,751
  • 23
  • 75
  • 132

6 Answers6

66

In Android Studio after renaming Package then go "build.gradle (Module:App)

defaultConfig {
       applicationId "com.example.android.abc"
       minSdkVersion 9
      targetSdkVersion 22
      versionCode 1
    versionName "1.0"
}

change the line

 applicationId "com.example.android.abc"

to

applicationId "com.tanxe.android.abc"

relpace "tanxe" with the word you want or your Organization name i.e.
your new package name and rebuild the project

Muhammad Akhtar
  • 669
  • 1
  • 5
  • 5
23

The best way to solve this is by going to the AndroidManifest.xml: package="com.example.android.yts"

Cursor on example

press

Shift+f6

change Package name eg. example to boss Click on refactor now `"com.boss.android.yts"``

2nd thing

open build.gradle (module:app) change applicationId "com.example.android.yts" to "com.boss.android.yts"

Tarsbir Singh
  • 527
  • 5
  • 11
  • 7
    This was a nice solution. However, if you are using `google-services.json`, read [this](https://stackoverflow.com/a/34923311/9768291). – payne May 01 '19 at 18:01
19

The error message is telling it all. You need to use a package name of your own. The package name is the identitiy of the application.

To rename the package name, In eclipse right click on the project in project explorer. Then Android Tools > rename Aplication Package name. Then enter the new package name.

Also make sure that you are trying to upload a release build

stinepike
  • 54,068
  • 14
  • 92
  • 112
2

Yes, com.example is the default package name for Android applications and is, as such, just a placeholder. You should replace it by a unique package name before uploading it to the Google Play Store. It doesn't particularly matter what it is, but it should relate to your application, cannot match any existing package name (so picking someone else's package name like com.android is not a good idea), and cannot be changed after publishing.

ianhanniballake
  • 191,609
  • 30
  • 470
  • 443
2
  1. Double-tap **package** from AndroidManifest.xml, refactor-> rename.

  2. Go to build.gradle and change applicationId under defaultConfig.

  3. If you have google-services.json, go to google-services.json and rename package_name in two places.

That should work.

Bensal
  • 3,316
  • 1
  • 23
  • 35
-2

Write something else than the com.example

for ex: com.gg.s etc will do(make that onj your name/firm name)

FraZer
  • 1,685
  • 1
  • 10
  • 17