use of com.android.tools.build.bundletool.model.exceptions.CommandExecutionException in project bundletool by google.
the class VariantGeneratorTest method targetsPreLOnlyInManifest_throws.
@Test
public void targetsPreLOnlyInManifest_throws() throws Exception {
int preL = 20;
BundleModule bundleModule = new BundleModuleBuilder("testModule").setManifest(androidManifest("com.test.app", withMaxSdkVersion(preL))).build();
CommandExecutionException exception = assertThrows(CommandExecutionException.class, () -> new VariantGenerator().generateVariants(bundleModule));
assertThat(exception).hasMessageThat().contains("does not target devices on Android L or above");
}
use of com.android.tools.build.bundletool.model.exceptions.CommandExecutionException in project bundletool by google.
the class BuildApksCommandTest method populateLineage_invalidFile.
@Test
public void populateLineage_invalidFile() {
CommandExecutionException e = assertThrows(CommandExecutionException.class, () -> BuildApksCommand.fromFlags(new FlagParser().parse("--bundle=" + bundlePath, "--output=" + outputFilePath, "--aapt2=" + AAPT2_PATH, "--ks=" + keystorePath, "--ks-key-alias=" + KEY_ALIAS, "--ks-pass=pass:" + KEYSTORE_PASSWORD, "--key-pass=pass:" + KEY_PASSWORD, "--lineage=" + tmp.newFile(), "--oldest-signer=" + oldestSignerPropertiesPath), fakeAdbServer));
assertThat(e).hasMessageThat().isEqualTo("The input file is not a valid lineage file.");
}
use of com.android.tools.build.bundletool.model.exceptions.CommandExecutionException in project bundletool by google.
the class ModuleSplitterTest method targetsPreLOnlyInManifest_throws.
@Test
public void targetsPreLOnlyInManifest_throws() throws Exception {
int preL = 20;
BundleModule bundleModule = new BundleModuleBuilder("testModule").setManifest(androidManifest("com.test.app", withMaxSdkVersion(preL))).build();
CommandExecutionException exception = assertThrows(CommandExecutionException.class, () -> ModuleSplitter.createForTest(bundleModule, BUNDLETOOL_VERSION).splitModule());
assertThat(exception).hasMessageThat().contains("does not target devices on Android L or above");
}
use of com.android.tools.build.bundletool.model.exceptions.CommandExecutionException in project bundletool by google.
the class D8DexMergerTest method mergeDoesNotFitIntoSingleDex_withoutMainDexList_preL_throws.
@Test
public void mergeDoesNotFitIntoSingleDex_withoutMainDexList_preL_throws() throws Exception {
// The two input dex files cannot fit into a single dex file.
Path dexFile1 = writeTestDataToFile("testdata/dex/classes-large.dex");
Path dexFile2 = writeTestDataToFile("testdata/dex/classes-large2.dex");
CommandExecutionException exception = assertThrows(CommandExecutionException.class, () -> new D8DexMerger().merge(ImmutableList.of(dexFile1, dexFile2), outputDir, /* mainDexListFile= */
NO_FILE, /* proguardMap= */
NO_FILE, /* isDebuggable= */
false, /* minSdkVersion= */
ANDROID_K_API_VERSION));
assertThat(exception).hasMessageThat().contains("multidex is not supported by the input");
}
use of com.android.tools.build.bundletool.model.exceptions.CommandExecutionException in project bundletool by google.
the class FusingAndroidManifestMergerTest method mergeChildrenMode_conflictMetadata_throws.
@Test
public void mergeChildrenMode_conflictMetadata_throws() {
SetMultimap<BundleModuleName, AndroidManifest> manifests = createManifests(androidManifest("com.testapp", withActivity("myActivity", activity -> activity.addChildElement(XmlProtoElementBuilder.create("meta-data").addAttribute(XmlProtoAttributeBuilder.createAndroidAttribute(NAME_ATTRIBUTE_NAME, NAME_RESOURCE_ID).setValueAsString("meta")).addChildText("Base text")))), androidManifestForFeature("com.testapp.feature1", withActivity("myActivity", activity -> activity.addChildElement(XmlProtoElementBuilder.create("meta-data").addAttribute(XmlProtoAttributeBuilder.createAndroidAttribute(NAME_ATTRIBUTE_NAME, NAME_RESOURCE_ID).setValueAsString("meta")).addChildText("Feature text")))));
CommandExecutionException exception = assertThrows(CommandExecutionException.class, () -> createMerger(Mode.MERGE_CHILDREN).merge(manifests));
assertThat(exception).hasMessageThat().contains("Multiple meta-data entries with the same name are found inside activity:myActivity");
}
Aggregations