Search in sources :

Example 11 with IncompatibleDeviceException

use of com.android.tools.build.bundletool.model.exceptions.IncompatibleDeviceException in project bundletool by google.

the class ApkMatcherTest method textureVariant_incompatibleDevice.

@Test
public void textureVariant_incompatibleDevice() {
    ZipPath apk = ZipPath.create("master-etc1_rgb8.apk");
    BuildApksResult buildApksResult = buildApksResult(createVariant(mergeVariantTargeting(variantSdkTargeting(sdkVersionFrom(Versions.ANDROID_L_API_VERSION)), variantTextureTargeting(ATC)), splitApkSet(/* moduleName= */
    "base", splitApkDescription(ApkTargeting.getDefaultInstance(), apk))));
    IncompatibleDeviceException exception = assertThrows(IncompatibleDeviceException.class, () -> new ApkMatcher(lDeviceWithGlExtensions("GL_OES_compressed_ETC1_RGB8_texture")).getMatchingApks(buildApksResult));
    assertThat(exception).hasMessageThat().contains("The app doesn't support texture compression formats of the device. Device formats:" + " [ETC1_RGB8], app formats: [ATC]");
}
Also used : BuildApksResult(com.android.bundle.Commands.BuildApksResult) ZipPath(com.android.tools.build.bundletool.model.ZipPath) IncompatibleDeviceException(com.android.tools.build.bundletool.model.exceptions.IncompatibleDeviceException) Test(org.junit.Test)

Example 12 with IncompatibleDeviceException

use of com.android.tools.build.bundletool.model.exceptions.IncompatibleDeviceException in project bundletool by google.

the class BuildApksDeviceSpecTest method deviceSpecPreL_bundleTargetsLPlus_throws.

@Test
public void deviceSpecPreL_bundleTargetsLPlus_throws() throws Exception {
    DeviceSpec deviceSpec = mergeSpecs(sdkVersion(/* KitKat */
    19), abis("x86"), locales("en-US"), density(XHDPI));
    bundleSerializer.writeToDisk(createMinSdkBundle(21), bundlePath);
    BuildApksCommand command = BuildApksCommand.builder().setBundlePath(bundlePath).setOutputFile(outputFilePath).setDeviceSpec(deviceSpec).build();
    IncompatibleDeviceException exception = assertThrows(IncompatibleDeviceException.class, command::execute);
    assertThat(exception).hasMessageThat().contains("App Bundle targets L+ devices, but the device has SDK version lower than L.");
}
Also used : DeviceSpec(com.android.bundle.Devices.DeviceSpec) IncompatibleDeviceException(com.android.tools.build.bundletool.model.exceptions.IncompatibleDeviceException) Test(org.junit.Test)

Aggregations

IncompatibleDeviceException (com.android.tools.build.bundletool.model.exceptions.IncompatibleDeviceException)12 ZipPath (com.android.tools.build.bundletool.model.ZipPath)10 Test (org.junit.Test)10 BuildApksResult (com.android.bundle.Commands.BuildApksResult)8 DeviceSpec (com.android.bundle.Devices.DeviceSpec)5 Path (java.nio.file.Path)5 ImmutableSet (com.google.common.collect.ImmutableSet)4 MultiAbiTargeting (com.android.bundle.Targeting.MultiAbiTargeting)2 BadgingInfo (com.android.tools.build.bundletool.device.BadgingInfoParser.BadgingInfo)2 TempDirectory (com.android.tools.build.bundletool.io.TempDirectory)2 Variant (com.android.bundle.Commands.Variant)1 Aapt2Command (com.android.tools.build.bundletool.androidtools.Aapt2Command)1 AdbCommand (com.android.tools.build.bundletool.androidtools.AdbCommand)1 CommandDescription (com.android.tools.build.bundletool.commands.CommandHelp.CommandDescription)1 FlagDescription (com.android.tools.build.bundletool.commands.CommandHelp.FlagDescription)1 ANDROID_SERIAL_VARIABLE (com.android.tools.build.bundletool.commands.CommandUtils.ANDROID_SERIAL_VARIABLE)1 AdbServer (com.android.tools.build.bundletool.device.AdbServer)1 AdbShellCommandTask (com.android.tools.build.bundletool.device.AdbShellCommandTask)1 BadgingInfoParser (com.android.tools.build.bundletool.device.BadgingInfoParser)1 Device (com.android.tools.build.bundletool.device.Device)1