Android facebook sdk内部实用程序java.lang.AssertionError

Swa*_*nil 13 timezone android facebook-graph-api android-facebook

我一直在使用4.27.0facebook sdk for android的版本.我一直在为Android 8+设备崩溃.堆栈跟踪如下:

Fatal Exception: java.lang.AssertionError: No NameTypeIndex match for SHORT_DAYLIGHT
       at android.icu.impl.TimeZoneNamesImpl$ZNames.getNameTypeIndex(TimeZoneNamesImpl.java:724)
       at android.icu.impl.TimeZoneNamesImpl$ZNames.getName(TimeZoneNamesImpl.java:790)
       at android.icu.impl.TimeZoneNamesImpl.getTimeZoneDisplayName(TimeZoneNamesImpl.java:183)
       at android.icu.text.TimeZoneNames.getDisplayName(TimeZoneNames.java:261)
       at java.util.TimeZone.getDisplayName(TimeZone.java:405)
       at java.util.TimeZone.getDisplayName(TimeZone.java:370)
       at com.facebook.internal.Utility.refreshTimezone(Utility.java:1066)
       at com.facebook.internal.Utility.refreshPeriodicExtendedDeviceInfo(Utility.java:1056)
       at com.facebook.internal.Utility.setAppEventExtendedDeviceInfoParameters(Utility.java:707)
       at com.facebook.internal.AppEventsLoggerUtility.getJSONObjectForGraphAPICall(AppEventsLoggerUtility.java:68)
       at com.facebook.FacebookSdk.publishInstallAndWaitForResponse(FacebookSdk.java:568)
       at com.facebook.FacebookSdk$4.run(FacebookSdk.java:547)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
       at java.lang.Thread.run(Thread.java:764)
Run Code Online (Sandbox Code Playgroud)

我通过网络搜索过这个但是无法获得任何有用的信息.请在此提供一些指示.

Noa*_*m a 8

我也面临这个问题,将Facebook SDK升级到最新版本(Facebook Android SDK 4.35),他们为此问题添加了一个解决方法:

 private static void refreshTimezone() {
    try {
        TimeZone tz = TimeZone.getDefault();
        deviceTimezoneAbbreviation = tz.getDisplayName(
                tz.inDaylightTime(new Date()),
                TimeZone.SHORT
        );
        deviceTimeZoneName = tz.getID();
    } catch (AssertionError e) {
      // Workaround for a bug in Android that can cause crashes on Android 8.0 and 8.1
    } catch (Exception e) {
    }
}
Run Code Online (Sandbox Code Playgroud)