Fix Android Studio layout preview
diff --git a/lottie/src/main/java/com/airbnb/lottie/LottieCompositionFactory.java b/lottie/src/main/java/com/airbnb/lottie/LottieCompositionFactory.java
index b1612b9..0589432 100644
--- a/lottie/src/main/java/com/airbnb/lottie/LottieCompositionFactory.java
+++ b/lottie/src/main/java/com/airbnb/lottie/LottieCompositionFactory.java
@@ -484,7 +484,6 @@
* Check if a given InputStream points to a .zip compressed file
*/
private static Boolean isZipCompressed(BufferedSource inputSource) {
-
try {
BufferedSource peek = inputSource.peek();
for (byte b : MAGIC) {
@@ -494,11 +493,13 @@
}
peek.close();
return true;
+ } catch (NoSuchMethodError e) {
+ // This happens in the Android Studio layout preview.
+ return false;
} catch (Exception e) {
Logger.error("Failed to check zip file header", e);
return false;
}
-
}
@Nullable