30

what is the best practice for naming a new android project ?

manlio
  • 18,345
  • 14
  • 76
  • 126
Gainster
  • 5,481
  • 19
  • 61
  • 90

2 Answers2

18

Do you have a name for your company?
eg com.mycompany.function
look at what other companies/orgs do:
Eclipse swt plugin project: org.eclipse.swt
JUNit: org.junit
Apache: org.apache.commons

katsharp
  • 2,551
  • 24
  • 27
  • 3
    Why it has to start with com ? – Gainster Mar 26 '11 at 23:51
  • 4
    com is for company, org is for organization. It depends who the project is for. Is the company/project website a .com or a .org domain is usually a good rule of thumb. – katsharp Mar 26 '11 at 23:53
  • 6
    The reason that package names usually start with reverse domain names (e.g., com.android) is that it ensures uniqueness. If everyone follows the convention, then package names between multiple applications will never conflict. – Zach Rattner Mar 26 '11 at 23:59
  • I see project name, Application and package name in eclipse ? – Gainster Mar 27 '11 at 00:03
3

Of course, when choosing a package name, understand how the Android Market will use it, and what the Android Dev Guide has to say about it.

http://developer.android.com/guide/publishing/publishing.html

http://developer.android.com/guide/topics/manifest/manifest-element.html

Package

A full Java-language-style package name for the application. The name should be unique. The name may contain uppercase or lowercase letters ('A' through 'Z'), numbers, and underscores ('_'). However, individual package name parts may only start with letters. To avoid conflicts with other developers, you should use Internet domain ownership as the basis for your package names (in reverse). For example, applications published by Google start with com.google. You should also never use the com.example namespace when publishing your applications.

The package name serves as a unique identifier for the application. It's also the default name for the application process (see the <application> element's process process attribute) and the default task affinity of an activity (see the <activity> element's taskAffinity attribute).

Caution: Once you publish your application, you cannot change the package name. The package name defines your application's identity, so if you change it, then it is considered to be a different application and users of the previous version cannot update to the new version.

Rufflewind
  • 8,545
  • 2
  • 35
  • 55
Thane Anthem
  • 4,093
  • 4
  • 26
  • 24
  • 4
    Per what you wrote, couldn't I just create a package name com.somewebsite even though I do not own the domain name somewebsite.com? Then the person who does own that website, if they ever made an Android app, would be fresh out of luck no? – Micro Aug 19 '15 at 19:20