A library for creating a wizard-like step-through user interface that uses navigation components and menus for displaying steps with advanced customization.
Apache License 2.0
325
stars
38
forks
source link
Crash on TextView.setTextAppearance (was added in API23) #15
If running the test app on a device with API lower than 23, the following crash appears:
Caused by: java.lang.NoSuchMethodError: No virtual method setTextAppearance(I)V in class Landroid/widget/TextView; or its super classes (declaration of 'android.widget.TextView' appears in /system/framework/framework.jar:classes2.dex)
Problem
If running the test app on a device with API lower than 23, the following crash appears:
Caused by: java.lang.NoSuchMethodError: No virtual method setTextAppearance(I)V in class Landroid/widget/TextView; or its super classes (declaration of 'android.widget.TextView' appears in /system/framework/framework.jar:classes2.dex)
Cause
The error is caused by one of these lines:
https://github.com/acefalobi/android-stepper/blob/b7c39b496ef673fbd2765f8a70ba99327c578f5d/stepper/src/main/java/com/aceinteract/android/stepper/menus/tab/TabNumberedStepperMenu.kt#L55
https://github.com/acefalobi/android-stepper/blob/b7c39b496ef673fbd2765f8a70ba99327c578f5d/stepper/src/main/java/com/aceinteract/android/stepper/menus/tab/TabNumberedStepperMenu.kt#L180
The problem is, that the used method
setTextAppearance
appeared only in API23: https://developer.android.com/reference/android/widget/TextView#setTextAppearance(int)Solution
To resolve the error minimum SDK should be rasied to 23:
https://github.com/acefalobi/android-stepper/blob/b7c39b496ef673fbd2765f8a70ba99327c578f5d/buildSrc/src/main/java/BuildConfiguration.kt#L6
Or
setTextAppearance
should be wrapped into the following check: