web-dev-qa-db-ja.com

Android facebook sdk internal utility Java.lang.AssertionError

Android向けFacebook SDKバージョン4.27.0を使用しています。 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)

私はこれをWebで検索しましたが、役に立つものは何もありませんでした。ここにいくつかのポインタを提供してください。

14
Swapnil

私もこの問題に直面しています。FacebookSDKを最新のものにアップグレードしてください(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) {
    }
}
8
Noam a

はい、ボレーライブラリを使用しているときにアプリでこの種の問題に直面しています。Android 8.0.1バージョンを搭載したデバイスでの使用.

致命的な例外:Java.lang.AssertionError SHORT_STANDARDに一致するNameTypeIndexがありません

Android.icu.impl.TimeZoneNamesImpl$ZNames.getNameTypeIndex 
(TimeZoneNamesImpl.Java:724)
Android.icu.impl.TimeZoneNamesImpl$ZNames.getName 
(TimeZoneNamesImpl.Java:790)
Android.icu.impl.TimeZoneNamesImpl.getTimeZoneDisplayName 
(TimeZoneNamesImpl.Java:183)
Android.icu.text.TimeZoneNames.getDisplayName (TimeZoneNames.Java:261)
Java.text.SimpleDateFormat.subFormat (SimpleDateFormat.Java:1296)
Java.text.SimpleDateFormat.format (SimpleDateFormat.Java:1004)
Java.text.SimpleDateFormat.format (SimpleDateFormat.Java:974)
Java.text.DateFormat.format (DateFormat.Java:341)
com.Android.volley.toolbox.HttpHeaderParser.formatEpochAsRfc1123 
(HttpHeaderParser.Java:152)
com.Android.volley.toolbox.BasicNetwork.getCacheHeaders 
(BasicNetwork.Java:256)
com.Android.volley.toolbox.BasicNetwork.performRequest 
(BasicNetwork.Java:130)
com.Android.volley.NetworkDispatcher.processRequest 
(NetworkDispatcher.Java:120)
com.Android.volley.NetworkDispatcher.run (NetworkDispatcher.Java:87)

Volley githubでこの issue を提起したとき、彼らがこれをデバイスフレームワークの問題であると確認した後、カスタマイズされたosバグの製造を意味します。バグが実際に始まる行が「Android.icu.text.TimeZoneNames.getDisplayName(TimeZoneNames.Java:261)」であるため、両方のスタックトレースで同じ問題が発生しているように感じます。これは、フレームワークに埋め込まれた ICUパッケージの問題 の詳細です。 IBM icuのクラスであるgoogle開発者の個人的に分岐した Gitクラス を見つけました。ここで、行番号722 "は新しいAssertionError( "Name typeIndex match for" + type); "はどちらのケースでも実際にエラーをスローしています。 Googleが修正またはそれに対する回避策を思い付くようにしましょう。私の観察は間違っているかもしれませんが、あなた自身の研究をしてください。

2
akashzincle