What should be the package name of android app?

后端 未结 7 1283
南方客
南方客 2020-11-29 01:53

I want to know that what should be the package name of android app? Means normally we used com.appname OR com.organizationName.appName, But when we are submitting our applic

7条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-29 02:01

    Android follows the same naming conventions like Java,

    Naming Conventions

    Package names are written in all lower case to avoid conflict with the names of classes or interfaces.

    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).

    Packages in the Java language itself begin with java. or javax.

    In some cases, the internet domain name may not be a valid package name. This can occur if the domain name contains a hyphen or other special character, if the package name begins with a digit or other character that is illegal to use as the beginning of a Java name, or if the package name contains a reserved Java keyword, such as "int". In this event, the suggested convention is to add an underscore. For example:

    Legalizing Package Names:

           Domain Name                            Package Name Prefix
    
    hyphenated-name.example.org             org.example.hyphenated_name
    example.int                             int_.example
    123name.example.com                     com.example._123name
    

提交回复
热议问题