android – How does eclipse know the name of your project?-ThrowExceptions

Exception or error:

I have a fully working project (lets say its called “mygame”) on disk which contains multiple activities. The activity which gets called first is called “launcher”. I wish for the project to be called “com.mycompany.mygame”, but when I do an import project in eclipse and select the root directory of my project, a dialog appears stating that the project that is located at this directory is “com.mycompany.mygame.launcher” with no way of changing it. My question is, what is eclipse using to determine that my project has the name “com.mycompany.mygame.launcher”? Is it something in the manifest?

How to solve:

I think the eclipse takes the class name which extends Activity. Because when u extend any other package like the Fragment etc., it won’t create the by default Launcher for that particular class. So whenever the Class name with manifest point to launcher will get imported along Or it will attach the class name. with the package name


Did you mean the project name changed? If that, you can check the .project file that is located in your project’s root folder.


Similar to your problem, when I try Import -> Android -> Existing Android code into workspace the naming is off.

For those who commented and were confused about the question, what is happening is that Eclipse imports the project as the name of the first activity (including the namespace).

It imports the project as

I have been having this problem for a while. I found the solution for my project. Because it is a git repo, I have to do Import -> Git – > Projects from Git -> local.

Then it imports correctly, and doesn’t have the side effect of some solutions mentioned here, importing existing code into a new project (which would probably remove my link to the git repo).


in eclipse, right click your project Android Tools -> Rename Application Package , change the name to com.mycompany.mygame


Why are you using eclipse ‘import existing project to workspace’ feature?

You should use ‘New Android Project -> Create Project From Existing Source’ feature.(I don’t know how these options exactly appear in your eclipse, so you’l have to find them) In this way you can rename it to anything.

Your Second option could be: Import existing project to workspace (as you are doing already). Leave the name of the project as it is, then after completing the import process, you can rename the project to whatever you want.


In your manifest file the name attribute in manifest tag will show the package name.Also the package explorer view in eclipse will show the package name.For example if your pkg name is,then your src folder will contain src>com>cmpny>game> foldersa and inside it will be your code saved.


In every Project there is file called .project which is responsible for project name

<?xml version="1.0" encoding="UTF-8"?>


The name ADT displays in the Package Explorer may not be the name in the .project file. To change this, right click on the name -> Refactor -> Rename. Change the name with “Update References” checked. Make sure the name you want is unique to your Package Explorer listing.


I think it is because of directory structure followed for all applications of same types, as all the application contains some files/folder on the root folder that is the name of our application e-g android project contains files like .project and .classpath and folders like .myeclipse src bin .settings etc


In the projects directory there is .project file created by eclipse ! when we import the project is searches for this file and collects the project related information from this file. That’s how its done. If u delete this file just for the purpose of checking eclipse will no more recognize that directory as a project !

Leave a Reply

Your email address will not be published. Required fields are marked *