How is AndroidManifest.xml validated in android studio?
Everything can be found on the https://android.googlesource.com.
The manifest model is not written as .xsd file. Instead it is written as a group of objects. The tree can be found here
If you start from Manifest
you can see, that it has the references to Application
, List<UsesPermission>
, etc. The Application
has references to android:name
and android:label
and List<Activity>
and so on.
A sample from Activity
object:
@Attribute("name")@Required@Convert(PackageClassConverter.class)@ExtendClass("android.app.Activity")AndroidAttributeValue<PsiClass> getActivityClass();
As you can see this is the way, that Android Studio knows, that activity
tag inside manifest must have a name. Two annotations are used:
@Attribute("name")@Required
One of them is the name of .xml tag attribute, and the second one informs, that this attribute is required.
The names of tags, that can be used inside manifest can be found here
A helper class used by Android Studio to get manifest properties can be found here
there isn't an actual schema for android manifest
I don't think this is correct. According to this answer:
The schemas don't exist as an xml file. Schemas are dependent upon what UI classes your program uses.
While there isn't a schema defined directly in an XML file, the valid tags and attributes can be defined elsewhere, such as in the Java code which parses and inflates an XML layout.