use of com.android.tools.build.bundletool.io.SdkBundleSerializer in project bundletool by google.
the class BuildApksCommandTest method sdkBundleHasInvalidManifestEntry_sdkBundleValidationFails.
@Test
public void sdkBundleHasInvalidManifestEntry_sdkBundleValidationFails() throws Exception {
new SdkBundleSerializer().writeToDisk(new SdkBundleBuilder().setModule(new BundleModuleBuilder("base").setManifest(androidManifest("package.name", withMinSdkVersion(32), // Major version must be a long.
withSdkLibraryElement("MajorVersionNotLong"))).build()).build(), sdkBundlePath1);
createAppBundle(bundlePath);
BuildApksCommand command = BuildApksCommand.fromFlags(new FlagParser().parse("--bundle=" + bundlePath, "--output=" + outputFilePath, "--sdk-bundles=" + sdkBundlePath1), fakeAdbServer);
Exception e = assertThrows(InvalidBundleException.class, command::execute);
assertThat(e).hasMessageThat().contains("SDK Major version in <" + SDK_LIBRARY_ELEMENT_NAME + "> cannot be parsed to a Long.");
}
Aggregations