When I create a project in android studio, the default path is java/app/com/example/myName/myProjectName. Can I change it to something like java/app/myName/myProjectName or just java/app/myProjectName? Can I delete the folder direcly in my workplace? What's the use of com/example?
-
`com.example` is intended for your company name. You don't have to use this. It can be for example, `com.google` and etc. – Yuchen Nov 18 '17 at 20:35
1 Answers
The major part of that path is the package name. In your case it's com.example.myName.myProjectName
.
Packages are essentially folders in the workspace.
If you only want to use the project name, there's one major disadvantage: if you upload to google play there may already be an existing app with that package, meaning you can't upload it.
com.example
is meant as the domain in the naming convensions, though there's no reason to follow these. You could remove that part completely and end up with a package name that's just myName.myProjectName
. So if you want, you can rename the package to exclude com.example
If you want to shorten the package name, just rename it in the IDE (so you don't need to deal with folder moving in the file explorer in your OS). Because it's android though, renaming the package isn't just right-clicking and pressing refactor
and that's it. It's slightly more complicated, but it's all explained here

- 27,060
- 21
- 118
- 148
-
Thanks! So can I just leave com.example like that and do not change anything? – Cong Yang Nov 19 '17 at 04:33
-