Package com.android.manifmerger
Class PreValidator
java.lang.Object
com.android.manifmerger.PreValidator
Validates a loaded
XmlDocument and check for potential inconsistencies in the model due
to user error or omission.
This is implemented as a separate class so it can be invoked by tools independently from the
merging process.
This validator will check the state of the loaded xml document before any merging activity is
attempted. It verifies things like a "tools:replace="foo" attribute has a "android:foo"
attribute also declared on the same element (since we want to replace its value).-
Method Summary
Modifier and TypeMethodDescriptionstatic MergingReport.Resultvalidate(MergingReport.Builder mergingReport, XmlDocument xmlDocument, boolean validateExtractNativeLibsFromSources, boolean validateExtractNativeLibsFromDependencies) Validates a loadedXmlDocumentand return a status of the merging model.
-
Method Details
-
validate
@NonNull public static MergingReport.Result validate(@NonNull MergingReport.Builder mergingReport, @NonNull XmlDocument xmlDocument, boolean validateExtractNativeLibsFromSources, boolean validateExtractNativeLibsFromDependencies) Validates a loadedXmlDocumentand return a status of the merging model.Will return one the following status :
MergingReport.Result.SUCCESS: the merging model is correct, merging should be attemptedMergingReport.Result.WARNING: the merging model contains non fatal error, user should be notified, merging can be attemptedMergingReport.Result.ERROR: the merging model contains errors, user must be notified, merging should not be attempted
- Parameters:
mergingReport- report to log warnings and errors.xmlDocument- the loaded xml part.validateExtractNativeLibsFromSources- whether to warn if theSdkConstants.ATTR_EXTRACT_NATIVE_LIBSattribute is set in a source (MAIN or OVERLAY) manifest.validateExtractNativeLibsFromDependencies- whether to warn if theSdkConstants.ATTR_EXTRACT_NATIVE_LIBSattribute is set to true in a dependency (LIBRARY) manifest.- Returns:
- one the
MergingReport.Resultvalue.
-