akexorcist / Localization

[Android] In-app language changing library
Apache License 2.0
983 stars 154 forks source link

Version 1.2.10 - ClassCastException in specific devices (Lenovo, Asus) #122

Open beqirajd opened 3 years ago

beqirajd commented 3 years ago

After upgrading to1.2.10 some crashes were reported in:

  1. Lenovo Tab M10 FHD Plus
  2. Lenovo Tab E10
  3. ZenFone 6 (ZS630KL) (WW) / 6Z (ZS630KL) (IN)

with Android Versions 8, 10 and 11.

When my activity class that extends LocalizationActivity is created, this crash occurs:

Caused by java.lang.ClassCastException: be.a cannot be cast to androidx.fragment.app.Fragment
       at androidx.fragment.app.Fragment.instantiate(Fragment.java:613)
       at androidx.fragment.app.FragmentContainer.instantiate(FragmentContainer.java:57)
       at androidx.fragment.app.FragmentManager$3.instantiate(FragmentManager.java:483)
       at androidx.fragment.app.FragmentStateManager.<init>(FragmentStateManager.java:85)
       at androidx.fragment.app.FragmentManager.restoreSaveState(FragmentManager.java:2728)
       at androidx.fragment.app.FragmentController.restoreSaveState(FragmentController.java:198)
       at androidx.fragment.app.FragmentActivity$2.onContextAvailable(FragmentActivity.java:149)
       at androidx.activity.contextaware.ContextAwareHelper.dispatchOnContextAvailable(ContextAwareHelper.java:99)
       at androidx.activity.ComponentActivity.onCreate(ComponentActivity.java:322)
       at androidx.fragment.app.FragmentActivity.onCreate(FragmentActivity.java:273)
       at com.akexorcist.localizationactivity.ui.LocalizationActivity.onCreate(LocalizationActivity.java:24)
       at com.xxx.MyCustomActivity.onCreate(MyCustomActivity.java:104)
akexorcist commented 2 years ago

Do you know what be.a is ? It was obfuscated.

beqirajd commented 2 years ago

Do you know what be.a is ? It was obfuscated.

It is obfuscated class. But I only get the error in production app and unfortunately I cannot figure out what the obfuscated fragment is.

akexorcist commented 2 years ago

You can upload mapping.txt that generated from obfuscate processing in Google Play.

It will help you to retrace mapping the obfuscated class in production to original class name.

image

akexorcist commented 2 years ago

Since AndroidX AppCompat has per-app language preferences for backward compatibility. Please migrate this library to AndroidX for more stability, compatibility, and longer support from Google team.

See Migrate to AndroidX guide

Thank you for your support