stripe / stripe-android

Stripe Android SDK
https://stripe.com/docs/mobile/android
MIT License
1.25k stars 635 forks source link

PaymentAuthWebViewActivity.onCreate : This Activity already has an action bar #8656

Open omarahmedx14 opened 2 months ago

omarahmedx14 commented 2 months ago

Summary

I have a production crash was being caught from Firebase crashlytics that says :

Fatal Exception: java.lang.RuntimeException Unable to start activity ComponentInfo{com.yatechnologies.yassir_rider/com.stripe.android.view.PaymentAuthWebViewActivity}: java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead.

Android version

it was happened to Android versions between 10 ~ 14

Impacted devices

it happened with many different devices.

Installation method

I use the SDK through a gradle dependency

Dependency Versions

kotlin: 1.9.21 stripe-android: 20.28.2 Android Gradle Plugin: 7.3.1 Gradle: 7.4

SDK classes

PaymentAuthWebViewActivity

Stack trace

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.yatechnologies.yassir_rider/com.stripe.android.view.PaymentAuthWebViewActivity}: java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead. at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3763) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3937) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2288) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:210) at android.os.Looper.loop(Looper.java:299) at android.app.ActivityThread.main(ActivityThread.java:8293) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045)

Caused by java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead. at androidx.appcompat.app.AppCompatDelegateImpl.setSupportActionBar(AppCompatDelegateImpl.java:630) at androidx.appcompat.app.AppCompatActivity.setSupportActionBar(AppCompatActivity.java:185) at com.stripe.android.view.PaymentAuthWebViewActivity.onCreate(PaymentAuthWebViewActivity.kt:60) at android.app.Activity.performCreate(Activity.java:8241) at android.app.Activity.performCreate(Activity.java:8207) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3736) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3937) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2288) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:210) at android.os.Looper.loop(Looper.java:299) at android.app.ActivityThread.main(ActivityThread.java:8293) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045)

seanzhang-stripe commented 2 months ago

Hi @omarahmedx14 Can you check your application theme file (i.e., style.xml ) and see if windowActionBar is set to true?

omarahmedx14 commented 2 months ago

Hi @omarahmedx14 Can you check your application theme file (i.e., style.xml ) and see if windowActionBar is set to true?

No I have : parent="Theme.MaterialComponents.Light.NoActionBar.Bridge"

and there is NO windowActionBar being set to true.

jaynewstrom-stripe commented 2 months ago

Hi @omarahmedx14 I can't reproduce this in our sample app. Could you provide a minimal, reproducible example?

omarahmedx14 commented 2 months ago

Hi @omarahmedx14 I can't reproduce this in our sample app. Could you provide a minimal, reproducible example?

I cannot reproduce it too, by the stack trace can't we guess/know how it can be reproduced ?

it's a productions issue and occurs in high numbers.