7

This is a small issue with Eclipse when dealing with the ADT.

Question:

When importing projects into Eclipse, the name is not coming up correctly. Even though it should just be the name (ex. "HelloWorld"), the name is actually tied to the package name (ex. "com.blah.HelloWorld"). I personally like the smaller name for the "Project Name" as it is easier to deal with in the Project Navigator. This happens when using the "android" option under the import window. If I use the "general" option, the issue does not happen.

I can just stick to using the general option when importing, but I feel the android option should work just fine. Any ideas??

orion
  • 89
  • 2
  • 7
  • possible duplicate of [Persistently setting the default name on an Android project in Eclipse](http://stackoverflow.com/questions/10211547/persistently-setting-the-default-name-on-an-android-project-in-eclipse) – mgibsonbr Nov 05 '12 at 19:43

2 Answers2

2

You can browse to menu Window > Preferences, select tab Java > Appearance. In box Abbreviate package name, replace the package name with a short string you prefer.

For example:

com.example.android={a}

Then all package names starting with com.example.android will be replace by {a}.

  • 1
    Thanks. I didn't know about this one, however, is it true that these rules only work for the exact package name you type. In other words if I choose a different package name than the example you gave, it won't work? Also, I edited the question after you answered. If looking at the fact this issue only happens when using the android option under import, why does the name look correct under a general import, but not an android import. Issue with the ADT or an expected result? – orion Jul 08 '12 at 15:54
  • Oh in that case I'm not sure :-(… – Lincoln Hawk Jul 08 '12 at 16:03
  • No problem. Thanks though. Really a strange situation. May have to go and report it to Android for the ADT. – orion Jul 08 '12 at 18:51
  • In the end, I was asked to post this as a bug. I believe we will have to wait until the ADT is modified to make this a non-issue. – orion Aug 06 '12 at 03:26
  • I have this too, except not for all projects. Do you have a link to your bug report please? – Rob Pridham Oct 31 '12 at 11:13
  • I also find that it changes the compatibility level on its own. It doesn't appear to be driven by Eclipse metadata - have tried a new workspace - but something must be influencing it. Doesn't happen on library projects. – Rob Pridham Oct 31 '12 at 11:29
  • The bug report seems to be [here](http://code.google.com/p/android/issues/detail?id=34885), and the issue is supposed to be fixed with the upcoming Android SDK r21. – sschuberth Nov 05 '12 at 15:40
  • Unfortunately r21 is out and this still appears to be a problem for me. – Rob Pridham Nov 21 '12 at 14:33
2

In my case, the project name is imported as MainActivity , always.
So I find some trick.
On AndroidManifest.xml, change activity name .MainActivity to the project name you want.
Then, import. You will success.
And re-change your manifest file.

Jehong Ahn
  • 1,872
  • 1
  • 19
  • 25