From 0611b525901d670d0f842950a93b046d74d110a5 Mon Sep 17 00:00:00 2001 From: GaryQian Date: Thu, 18 Oct 2018 13:04:18 -0700 Subject: [PATCH] Gate locale.getScript() behind version check for android API < 21 --- shell/platform/android/io/flutter/view/FlutterView.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index 4f1f151d74705..f7a8dacac61c9 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -345,7 +345,11 @@ private void setLocales(Configuration config) { List data = new ArrayList(); data.add(locale.getLanguage()); data.add(locale.getCountry()); - data.add(locale.getScript()); + if (Build.VERSION.SDK_INT >= 21) { + data.add(locale.getScript()); + } else { + data.add(""); + } data.add(locale.getVariant()); mFlutterLocalizationChannel.invokeMethod("setLocale", Arrays.asList(locale.getLanguage(), locale.getCountry(), locale.getScript(), locale.getVariant()));