I want to create apps under my company's name and Android Studio recommends using your domain, eg:
domain: example.com
App: myApp
gives a package name of com.example.myApp
That's all fine, but my company name begins with a number and Android Studio informs me I can't have numbers, eg:
com.1example.myApp
Now I could try "oneexample" and hopefully no-one from oneexample.com starts developing Android apps, but given how many devs appear to have a number at the start of their name, presumably this has come up before. So if I can please ask:
1) How should I tackle naming my packages?
2) Out of curiosity, why can't you have package names beginning with a number?
Thanks heaps!
Quentin.
Short Answer: Android package/subpackage names must begin with an ASCII Latin letter. Since there seems to be no guidance from Google on package naming in cases where domain names begin with a number, developers are left to resolve this themselves.
Here are some real-world examples of domain names starting with a number, and the package names the developers decided to use for Android:
http://www.11bitstudios.com/
https://play.google.com/store/apps/details?id=com.elevenbitstudios.AnomalyWarzoneEarthHD
http://www.23snaps.com/
https://play.google.com/store/apps/details?id=com.snaps23.android
http://www.36you.com/
https://play.google.com/store/apps/details?id=com.thirtysixyougames.google.slotanddragons
Further Background
Java allows package names to begin with an ASCII Latin letter or an underscore character. From Naming a Package (The Java™ Tutorials > Learning the Java Language > Packages):
The following examples of "Legalizing Package Names" are also shown:
However, Android is more restrictive than Java, and package/subpackage names may NOT begin with an underscore. From Issue 65570 - Android Open Source Project - Issue Tracker - Google Project Hosting:
Unfortunately, there doesn't seem to be any suggested convention from Google on legalizing package names for domains that begin with a number for Android.
From Chapter 3. Lexical Structure (The Java® Language Specification - Java SE 7 Edition):
<snip>
Again, this is further restricted in Android package names. From <manifest> | Android Developers:
Thanks, @Quentin, for providing info on Android's additional restrictions over Java.