Omitting the point and not fully qualifying the name of the package / class will work if and only if the specified class is not part of the subpackage in your application.
If your application package name is com.example.myapp , and you have the activity class com.example.myapp.MyActivity :
android:name="MyActivity" will work.android:name=".MyActivity" will work.android:name="com.example.myapp.MyActivity" will work.
But if you have the same application package and activity class in a subpackage inside the source tree, for example com.example.myapp.myactivities.MyActivity , everything changes.
android:name=".myactivities.MyActivity" will workandroid:name="com.example.myapp.myactivities.MyActivity" will workandroid:name="MyActivity" will not workandroid:name="myactivities.MyActivity" will not work
3 does not work, because it will mean that the class name that you mean is actually com.example.myapp.MyActivity , as in the first example above. A class with this name will not be found, and you will receive an error message.
4 does not work, because it looks like the full name of the class, that is, the system will interpret it as meaning that myactivities.MyActivity is the full name, not the real name com.example.myapp.myactivities.MyActivity .
You need a leading point here to make it clear that you are using a relative path, not an absolute path. If you specify only the class name without package information, the system will report that the class is at the root of your application package hierarchy.
adamp
source share