1

Does an Android package name has to include three parts eg: net.test.package

Or can it also be manualy changed to eg: test.package

Michael Irigoyen
  • 22,513
  • 17
  • 89
  • 131
Luc
  • 617
  • 3
  • 10
  • 18
  • Its not necessary that package name include three parts. You can change this according to your requirement – Deepika Nov 05 '12 at 12:15
  • Look at http://stackoverflow.com/questions/8075162/what-should-be-the-package-name-of-android-app – user370305 Nov 05 '12 at 12:16

4 Answers4

9

Technically the package name can be anything, but it's highly recommended that you use a reverse domain name format, eg. if your website were http://luc.com you'd use com.luc.appname.

Estel
  • 2,154
  • 2
  • 18
  • 25
  • 4
    if your domain starts with a number (like mine) then you have to think of something else as you get "A digit cannot be the first character in a segment" - helpful. – Recycled Steel Jul 22 '15 at 11:10
  • @RecycledSteel What are you supposed to do in a case like this? Lie about your domain? My domain only has numbers in it... – Michael Sep 24 '22 at 18:13
1

Yes.It can be Any you can set any time if you want to change.

Its actually as per your requirement.

See this if you want to change :

GO TO Project > src > Package Dir > 
Right Click > Refactor  > Rename 

OR

GO TO Project > src > Package Dir > 
F2 > Set New Package Name.
Chintan Khetiya
  • 15,962
  • 9
  • 47
  • 85
0

The package name is used for unique identification for your application. In android uses the package name to determine one application has been installed or not. The general naming is: com.companyname.applicationname eg: com.android.Camera

Its not compulsory that package name include three parts. You can change it according to your requirement.

Neal
  • 379
  • 4
  • 9
0

There is no strict convention per se. But it is always good to follow conventions (IMHO). And Android, in principal, follows Java's package naming conventions. You can get more information at these sites:

  1. http://www.quora.com/Android-OS/Why-do-a-majority-of-Android-package-names-begin-with-com
  2. http://en.wikipedia.org/wiki/Java_package#Package_naming_conventions

Disclaimer: The above is from an answer here on SO: https://stackoverflow.com/a/6273935/450534. All credits to Jimmy Huch for a brilliant answer. Do, up-vote his answer. ;-)

EDIT: And yes, you can rename your package after a project has been created. A few errors might be thrown, but a few simple imports will fix them. That being said, it is always better to decide on something and stick to it. Makes life a tad easier.

Community
  • 1
  • 1
Siddharth Lele
  • 27,623
  • 15
  • 98
  • 151