What is the rule for package names starting with a number?

Android package naming convention:

com.organizationName.appName 

But if the name of the organization or the name of the application starts with a number or underscore, it becomes an invalid name, since the android does not accept words starting with a number or underscore.

For example:

com.1organizationName.appName not valid

What is the rename agreement for this package?

+7
source share
5 answers

In the official "Package Naming" of java documentation, it has the following statement:

In some cases, the Internet domain name may be an invalid name. This can happen if the domain name contains a hyphen or other special character , if the package name starts with a digit or another character that is illegal to use as the start of a Java name , or if the package name contains a reserved Java keyword, such as "int " In this case, the proposed agreement is to add underlining .

So in your case it will be com._1organizationname.appname

EDIT: just found this in Android docs :

The full name of the Java-style package for the application. The name must be unique. The name can contain uppercase or lowercase letters ('A' through 'Z'), numbers and underscores ('_'). However, the individual parts of a package name may begin only with letters.

This seems to be not quite a Java style. Unfortunately, it seems your best bet in this case would actually be to indicate the quantity, for example. com.oneorganizationname.appname .

+19
source

The naming convention simply helps you create a unique package name for the Play market. If you use your company’s website address back (i.e. Com.websitename.appname), it is unlikely that he will have another application on the gaming market. You can name the package as you like so that you can write down the number to simplify it (com.oneOrganizationName.appName).

+2
source

you can try co.m_1organizationName.appName or co.m1organizationName.appName so that your package is not absurd and the address will be more meaningful.

0
source

See here for the "package" attribute in the manifest:

The full name of the Java-style package for the application. The name must be unique. The name can contain uppercase or lowercase letters ('A' through 'Z'), numbers and underscores ('_'). However, the individual parts of a package name may begin only with letters. To avoid conflicts with other developers, you should use Internet ownership as the basis for the names of your packages (in reverse order). For example, hotels published by Google begin 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. This is also the default name for the application process (see the process attribute of the element) and the default affinity of the task for activity (see taskAffinity).

0
source

You know, it only costs $ 5 to register a new domain name. Just register oneorganizationName.com and use it. You know that it will be unique, you know that it will be the real name of the package, and now you know that phishers and spoofing will not register oneorganizationName.com for themselves in order to deceive your customers.

-2
source

All Articles