What should be the package name of android app?

后端 未结 7 1231
南方客
南方客 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 01:58

    Package name is the reversed domain name, it is a unique name for each application on Playstore. You can't upload two apps with the same package name. You can check package name of the app from playstore url

    https://play.google.com/store/apps/details?id=package_name

    so you can easily check on playstore that this package name is in used by some other app or not before uploading it.

    0 讨论(0)
  • 2020-11-29 02:01

    As stated here: 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:

    enter image description here

    0 讨论(0)
  • 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
    
    0 讨论(0)
  • 2020-11-29 02:06

    Presently Package name starting with "com.example" is not allowed to upload in the app -store. Otherwise , all other package names starting with "com" are allowed .

    0 讨论(0)
  • 2020-11-29 02:08

    package name with 0 may cause problem for sharedPreference.

    (OK) con = createPackageContext("com.example.android.sf1", 0);

    (Problem but no error)

    con = createPackageContext("com.example.android.sf01", 0);
    
    0 讨论(0)
  • 2020-11-29 02:12

    Visit https://developers.google.com/mobile/add and try to fill "Android package name". In some cases it can write error: "Invalid Android package name".

    In https://developer.android.com/studio/build/application-id.html it is written:

    And although the application ID looks like a traditional Java package name, the naming rules for the application ID are a bit more restrictive:

    • It must have at least two segments (one or more dots).
    • Each segment must start with a letter.
    • All characters must be alphanumeric or an underscore [a-zA-Z0-9_].

    So, "0com.example.app" and "com.1example.app" are errors.

    0 讨论(0)
提交回复
热议问题