For the "Hello World" example in android.com, the package name is"package com.example.helloandroid;"
Is there any guideline/standard to name this package? (references would be nice)
Android follows normal java package conventions plus here is an important snippet of text to read (this is important regarding the wide use of xml files while developing on android).
The reason for having it in reverse order is to do with the layout on the storage media. If you consider each period ('.') in the application name as a path separator, all applications from a publisher would sit together in the path hierarchy. So, for instance, packages from Adobe would be of the form:
com.adobe.reader (Adobe Reader)
com.adobe.photoshop (Adobe Photoshop)
com.adobe.ideas (Adobe Ideas)
[Note that this is just an illustration and these may not be the exact package names.]
These could internally be mapped (respectively) to:
com/adobe/reader
com/adobe/photoshop
com/adobe/ideas
The concept comes from Package Naming Conventions in Java, more about which can be read here:*
http://en.wikipedia.org/wiki/Java_package#Package_naming_conventions
Source: http://www.quora.com/Why-do-a-majority-of-Android-package-names-begin-with-com
The package name is used for unique identification for your application.
Android uses the package name to determine if the application has been installed or not.
The general naming is:
com.companyname.applicationname
eg:
com.android.Camera
http://docs.oracle.com/javase/tutorial/java/package/namingpkgs.html
Companies use their reversed Internet domain name to begin their package names—for example, com.example.mypackage for a package named mypackage created by a programmer at example.com.
Name collisions that occur within a single company need to be handled by convention within that company, perhaps by including the region or the project name after the company name (for example, com.example.region.mypackage).
If you have a company domain www.example.com
Then you should use:
com.example.region.projectname
If you own a domain name like example.co.uk than it should be:
uk.co.example.region.projectname
If you do not own a domain, you should then use your email address:
for name@example.com it should be:
com.example.name.region.projectname
Com = commercial application (just like .com, most people register their app as a com app)
First level = always the publishing entity's' name
Second level (optional) = sub-devison, group, or project name
Final level = product name
For example he android launcher (home screen) is Com.Google.android.launcher
Generally the first 2 package "words" are your web address in reverse. (You'd have 3 here as convention, if you had a subdomain.)
So something stackoverflow produces would likely be in package com.stackoverflow.whatever.customname
something asp.net produces might be called net.asp.whatever.customname.omg.srsly
something from mysubdomain.toplevel.com would be com.toplevel.mysubdomain.whatever
Beyond that simple convention, the sky's the limit. This is an old linux convention for something that I cannot recall exactly...
But if your Android App is only for personal purpose or created by you alone, you can use:
me.app_name.app
来源:https://stackoverflow.com/questions/6273892/android-package-name-convention