-10

In my AndroidManifest.xml i have a warning in the line code below.

<service android:name=".Helper.LocationService"/>

The warning is:

Inner classes should use $ rather than . When you reference an inner class in a manifest file, you must use '$' instead of '.' as the separator character, i.e. Outer$Inner instead of Outer.Inner.

So, Why use '$' instead of '.', if when I use '.' still works?

Messias Tayllan
  • 186
  • 2
  • 10

1 Answers1

2

It is suggested to use $ in order not to confuse the outer class name with the package name. So $ when you want to refer to an InnerClass and . when referring to the package.

For example if Helper is a package name then (lowercase is suggested for package names):

<service android:name=".helper.LocationService"/>

where if Helper is a class and LocationService is an inner class defined inside Helper

<service android:name=".Helper$LocationService"/>
pleft
  • 7,567
  • 2
  • 21
  • 45