Closed kyh8496 closed 3 years ago
https://github.com/akexorcist/Localization/pull/83
Because of the above issue, 1.2.7 should be used. When can the issue be fixed?
Let me try to create the custom alert dialog fragment in my test project. Would be great if you provide more about code in your custom alert dialog fragment.
With my simple testing. Everything seem work fine. See https://github.com/akexorcist/Localization/commit/ec60f45295e925f8e248cd20b65f7e8a71085c14
Issue might caused by some implementation in your custom dialog fragment. Please show me your code if you can or paste the full error message from crashing
full error message
Caused by java.lang.UnsupportedOperationException
Failed to resolve attribute at index 6: TypedValue{t=0x2/d=0x101009b a=1}
myproject.common.CommonAlertDialogFragment.onCreateView
android.content.res.TypedArray.getColorStateList (TypedArray.java:546)
android.widget.TextView.readTextAppearance (TextView.java:3888)
android.widget.TextView.
I made the sample project
https://github.com/kimyounghoons/PopupTest
MainActivity -> SecondActivity -> Back MainActivity -> Show Popup -> Crash!!
It doesn't die without a webview.
and the Issue is occurs on specific devices.
Galaxy J7 , Galaxy J5 , Galaxy Note 8, Galaxy Note 9, Galaxy S10 5G , Galaxy A9 (2018), LG G6 ...etc
The sample project also does not occur when downgrading to 1.2.6.
Have you seen the sample project?
@kyh8496 Just crashing on my LG Nexus 5X (but works fine on Google Pixel 2 and Samsung Galaxy Z Fold 2). Thank you for your sample project to reproduce this issue. The problem is specific happen on Android 8.0 (API Level 26)
Let me check it more for a while.
@kyh8496 This seems surprising to me. WebView in another activity make the dialog fragment crashing in API 26 only!
Because I changed how to update the resource's locale in 1.2.7
// LocalizationActivityDelegate.getResources(resources: Resources)
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O -> {
val config = Configuration().apply {
setLocale(locale)
setLocales(localeList)
setLayoutDirection(locale)
}
activity.createConfigurationContext(config).resources
}
I don't know how it happen. But I will directly update the locale in resource's configuration instead of creating new configuration when device running on API 26
Build.VERSION.SDK_INT > Build.VERSION_CODES.O -> {
val config = Configuration().apply {
setLocale(locale)
setLocales(localeList)
setLayoutDirection(locale)
}
activity.createConfigurationContext(config).resources
}
Build.VERSION.SDK_INT == Build.VERSION_CODES.O -> {
resources.configuration.apply {
setLocale(locale)
setLocales(localeList)
setLayoutDirection(locale)
}
resources
}
Most of the issues posted on Firebase Crashlytics were Android 8 or 9.
@kyh8496 Thanks for your information
@kyh8496 v2.1.9 is live including fixes this issue .
Oh~ Thank you very much, you're a great developer!! I'll test this issue
One more thing. I moved v1.2.9 to MavenCentral.
okay! I will upload it using version 1.2.9 and track if it crashes. thanks ~!
Feel free to reopen this issue again if you still has this problem
I'm using 1.2.7 version override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { return inflater.inflate(getResId(), container, false) <<<< error line }
An error occurs when creating a customAlertDialogFragment. I guess the theme was influenced.
It doesn't happen if I downgrade to 1.2.6 version.