Adyen / adyen-android

Adyen Android Drop-in and Components
https://docs.adyen.com/checkout/android
MIT License
124 stars 66 forks source link

NPE crash when i run demo, click Start -> Credit Card -> Booooom! #1275

Closed foxcode7 closed 1 year ago

foxcode7 commented 1 year ago

Describe the bug

java.lang.NullPointerException
at android.content.res.XmlBlock.nativeGetStyleAttribute(Native Method)
at android.content.res.XmlBlock.-$$Nest$smnativeGetStyleAttribute(Unknown Source:0)
at android.content.res.XmlBlock$Parser.getStyleAttribute(XmlBlock.java:471)
at android.content.res.Resources$Theme.getExplicitStyle(Resources.java:1976)
at android.view.View.retrieveExplicitStyle(View.java:6722)
at android.view.View.<init>(View.java:5830)
at android.view.ViewGroup.<init>(ViewGroup.java:707)
at android.widget.LinearLayout.<init>(LinearLayout.java:254)
at android.widget.LinearLayout.<init>(LinearLayout.java:250)
at com.adyen.checkout.card.internal.ui.view.CardView.<init>(CardView.kt:63)
at com.adyen.checkout.card.internal.ui.CardViewProvider.getView(CardViewProvider.kt:30)
at com.adyen.checkout.ui.core.AdyenComponentView.loadView(AdyenComponentView.kt:122)
at com.adyen.checkout.ui.core.AdyenComponentView.access$loadView(AdyenComponentView.kt:49)
at com.adyen.checkout.ui.core.AdyenComponentView$attach$1.invokeSuspend(AdyenComponentView.kt:105)
at com.adyen.checkout.ui.core.AdyenComponentView$attach$1.invoke(Unknown Source:8)
at com.adyen.checkout.ui.core.AdyenComponentView$attach$1.invoke(Unknown Source:4)
at kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1$2.emit(Emitters.kt:223)
at kotlinx.coroutines.flow.StateFlowImpl.collect(StateFlow.kt:398)
at kotlinx.coroutines.flow.StateFlowImpl$collect$1.invokeSuspend(Unknown Source:15)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.EventLoop.processUnconfinedEvent(EventLoop.common.kt:69)
at kotlinx.coroutines.internal.DispatchedContinuationKt.resumeCancellableWith(DispatchedContinuation.kt:376)
at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt:30)
at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable$default(Cancellable.kt:25)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:110)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:126)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:56)
at kotlinx.coroutines.BuildersKt.launch(Unknown Source:1)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(Builders.common.kt:47)
at kotlinx.coroutines.BuildersKt.launch$default(Unknown Source:1)
at kotlinx.coroutines.flow.FlowKt__CollectKt.launchIn(Collect.kt:49)
at kotlinx.coroutines.flow.FlowKt.launchIn(Unknown Source:1)
at com.adyen.checkout.ui.core.AdyenComponentView.attach(AdyenComponentView.kt:112)
at com.adyen.checkout.dropin.internal.ui.CardComponentDialogFragment.onViewCreated(CardComponentDialogFragment.kt:42)
at androidx.fragment.app.Fragment.performViewCreated(Fragment.java:3147)
at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:588)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:272)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1943)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1845)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1782)
at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:565)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8757)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)

To Reproduce Steps to reproduce the behavior:

  1. Use Samsung Device, Run demo
  2. Click on 'Start'
  3. Choose Payment Methods 'Credit Card'
  4. See error

Smartphone (please complete the following information):

OscarSpruit commented 1 year ago

Hi @foxcode7, thank you for reporting! We have seen this issue before and it is caused by the developer option "Enable view attribute inspection". Please make sure that option is disabled. Also the layout inspector in Android Studio can cause this and sometimes a device can't recover from this state (you would have to factory reset it). As far a we could find and from our experience, this can only happen to developers, so users of a production app should be safe

jreij commented 1 year ago

Hi @foxcode7 , were you able to solve this issue or do you still need our help with anything?

jreij commented 1 year ago

Closing this issue for inactivity, please reopen if you still need help.

jreij commented 8 months ago

HI @foxcode7, we have identified what was causing this crash and fixed it in version 5.0.1.