Class PreValidator

java.lang.Object
com.android.manifmerger.PreValidator

public class PreValidator extends Object
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 Details

    • validate

      @NonNull public static MergingReport.Result validate(@NonNull MergingReport.Builder mergingReport, @NonNull XmlDocument xmlDocument, boolean validateExtractNativeLibsFromSources, boolean validateExtractNativeLibsFromDependencies)
      Validates a loaded XmlDocument and return a status of the merging model.

      Will return one the following status :

      A successful validation does not mean that the merging will be successful.
      Parameters:
      mergingReport - report to log warnings and errors.
      xmlDocument - the loaded xml part.
      validateExtractNativeLibsFromSources - whether to warn if the SdkConstants.ATTR_EXTRACT_NATIVE_LIBS attribute is set in a source (MAIN or OVERLAY) manifest.
      validateExtractNativeLibsFromDependencies - whether to warn if the SdkConstants.ATTR_EXTRACT_NATIVE_LIBS attribute is set to true in a dependency (LIBRARY) manifest.
      Returns:
      one the MergingReport.Result value.