Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get rid of the warning: Use '$' instead of '.' for inner classes in Eclipse

Tags:

I am new to Android development. After I updated my eclipse and Android SDK to the newest version, I got an warning:

Use '$' instead of '.' for inner classes (or use only lowercase letters in package names)   AndroidManifest.xml

I Found some information on this link.

"When you reference an inner class in a manifest file, you must use '$' instead of '.' " +
    "as the separator character, e.g. Outer$Inner instead of Outer.Inner.\n" +
    "\n" +
    "(If you get this warning for a class which is not actually an inner class, it's " +
    "because you are using uppercase characters in your package name, which is not " +
    "conventional.)"

I believe that I used uppercase characters in sub package name like com.abc.app.Promotion.

The question is: What is the best way to get rid of this warning in the manifest.xml? It still can build and run but I find it so annoying.

I tried using refactor to rename the package and modified the manifest.xml android:name="com.abc.app.promotion.Promotion" but got this error:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.abc.app/com.abc.app.TabView}: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.abc.app/com.abc.app.promotion.Promotion}; have you declared this activity in your AndroidManifest.xml?

Thanks for helping!

EDIT: original manifest.xml

<activity android:name=".Promotion.Promotion" ></activity>

updated manifest.xml

<activity android:name="promotion.Promotion" ></activity>
like image 785
EES Avatar asked Nov 29 '12 09:11

EES


2 Answers

If you get this warning for a class which is not actually an inner class, it's because you are using uppercase characters in your package name, which is not conventional.

I tried also to change only the first letter of the package name to be lower case, the warning disappeared.

like image 136
MBH Avatar answered Sep 26 '22 05:09

MBH


You must use lower case in your package name

or add this atrr in application tag

tools:ignore="InnerclassSeparator"

To Ignore this Waring

like image 27
Mahmoud Abu Alheja Avatar answered Sep 23 '22 05:09

Mahmoud Abu Alheja