I have a very basic question with respect to app development. I have no experience in app development, but, I need to reverse engineer android apps. When I reverse engineer (decompile using apktool or androguard) apps, I am seeing that every app has a package (folder structure) that begins with "com". Does every app have this com folder (I guess eclipse creates this folder, inside which the developers code). Is this assumption valid for all apps?
4 Answers
No its not necessary to have com
folder.
The com folder is because of package name.
If you take any package, lets say - com.sudosaints.android
So in this case src code directory structure will be - src -> com -> sudosaints -> android.
In case of in.sudosaints.android
, directory structure will be - src->in->sudosaints->android
So assumption of com
folder is not valid for all apps.

- 3,416
- 3
- 28
- 32
-
Okay, got it, thanks! I wish to ask one more important thing here. Is there a set of keywords (like com, org, in etc.) within which the root of an app's package structure will begin with? – Annamalai N Sep 10 '13 at 10:50
-
Not sure bt you can try 'src' folder – Vishal Pawale Sep 10 '13 at 10:55
-
When I decompile the code, I do not see a "src" folder. I use baksmali (from apk tool). Is there any other decompilation tool that gives the folder structure? – Annamalai N Sep 10 '13 at 11:00
-
No there is no such set of keywords you can search for – Vishal Pawale Sep 10 '13 at 11:01
No, it's not. You can choose what to use as namespace. Many developers uses "com" for commercial applications and "org" for free ones but it's entirely up to you.

- 610
- 1
- 6
- 11
-
Okay, got it, thanks! I wish to ask one more important thing here. **Is there a set of keywords** (like com, org, in etc.) within which the root of an app's package structure will begin with? – Annamalai N Sep 10 '13 at 10:57
-
@AnnamalaiN see my answer below. Generally, any string could be root of package structure. There are conventions, but no way to force it... – hendrix Sep 10 '13 at 11:15
-
Namespaces are mainly designed for disambiguation of classes. Theorically you can name two classes with the same name but in different namespaces. Subclassing is a typical example but you can use them as you want: root is usually "com", "org" or "net" but they can be whatever you choose. – Axel GeNuS Sep 13 '13 at 10:47
I am not 100% sure whether or not this can be overridden, but it is based on the package name of the application. The recommended way, which as far as I have seen, all developers do follow create a package called com.yourcompany.yourappname
.
In this example the source code would be found in:
com.yourcompany.yourappname/src
.
Hope this helps.

- 35,417
- 104
- 256
- 447
General convention for naming packages is based on domain owned by author of the program.
For example, if your company has webpage
www.mycompany.com
their programs will generaly have package structure starting with
com.mycompany.nameofproject
So thats why most packages start with com
, because most companies have webpage ending with .com
.

- 3,364
- 8
- 31
- 46