Stripe-android: Crash caused by ChallengeActivity - You must supply a layout_width attribute.

Created on 12 Sep 2019  路  8Comments  路  Source: stripe/stripe-android

Summary

While testing with test card number 4000 0000 0000 3220 the application crashes. Once the confirm setup intent method is called another activity with the Visa logo and a loading spinner comes on top and it immediately crashes.

Code to reproduce

`val confirmSetupIntentParams = ConfirmSetupIntentParams.create(paymentMethodId, mViewModel.clientSecret)

    PaymentAuthConfig.init(PaymentAuthConfig.Builder()
            .set3ds2Config(PaymentAuthConfig.Stripe3ds2Config.Builder()
                    // set a 5 minute timeout for challenge flow
                    .setTimeout(5)
                    .build())
            .build())
    stripe.confirmSetupIntent(this, confirmSetupIntentParams)`

Android version

Android 8 & 9

Impacted devices

Only tested on Samsung S7 and the simulator

Installation method

SDK version

Latest version - 11.0.1

Other information

This is the stack trace I see when the app crashes

2019-09-12 14:10:13.367 8114-8114/uk.co.myapp.androidapp E/AndroidRuntime: FATAL EXCEPTION: main Process: uk.co.myapp.androidapp, PID: 8114 java.lang.RuntimeException: Unable to start activity ComponentInfo{uk.co.myapp.androidapp/com.stripe.android.stripe3ds2.views.ChallengeActivity}: android.view.InflateException: Binary XML file line #18: Binary XML file line #18: You must supply a layout_width attribute. at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6669) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) Caused by: android.view.InflateException: Binary XML file line #18: Binary XML file line #18: You must supply a layout_width attribute. Caused by: java.lang.UnsupportedOperationException: Binary XML file line #18: You must supply a layout_width attribute. at android.content.res.TypedArray.getLayoutDimension(TypedArray.java:779) at android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:7757) at android.view.ViewGroup$MarginLayoutParams.<init>(ViewGroup.java:7949) at android.widget.LinearLayout$LayoutParams.<init>(LinearLayout.java:1997) at android.widget.LinearLayout.generateLayoutParams(LinearLayout.java:1895) at android.widget.LinearLayout.generateLayoutParams(LinearLayout.java:87) at android.view.LayoutInflater.rInflate(LayoutInflater.java:865) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at android.view.LayoutInflater.rInflate(LayoutInflater.java:866) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at android.view.LayoutInflater.inflate(LayoutInflater.java:515) at android.view.LayoutInflater.inflate(LayoutInflater.java:423) at android.view.LayoutInflater.inflate(LayoutInflater.java:374) at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:555) at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161) at com.stripe.android.stripe3ds2.views.ChallengeActivity.onCreate(Unknown Source:18) at android.app.Activity.performCreate(Activity.java:7136) at android.app.Activity.performCreate(Activity.java:7127) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6669) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

triaged

Most helpful comment

@tudorsirbu can you try the latest version, 11.0.4?

All 8 comments

@tudorsirbu I haven't been able to repro this crash. Can you provide more details, such as what other dependencies you're using, especially which AndroidX dependencies? Are there any scenarios where you don't experience a crash?

Works fine with the other test card numbers (e.g. 4000 0027 6000 3184) so I'm not sure if it's an isolated issue to the card number I mentioned initially.

I do not think it's Android X related. Until today we were using Stripe SDK version 10.3.1 which had the exact same issue. I've updated to 11.0.1 hoping it would solve the issue but it hasn't.

Here's a list of all dependencies we use:

`implementation 'ru.superjob:kotlin-permissions:1.0.2'

implementation 'com.airbnb.android:epoxy:3.5.0'
implementation "com.airbnb.android:epoxy-databinding:3.5.0"
kapt 'com.airbnb.android:epoxy-processor:3.5.0'


// android support libraries
implementation "androidx.appcompat:appcompat:$rootProject.supportLibraryVersion"
implementation "androidx.recyclerview:recyclerview:$rootProject.supportLibraryVersion"
implementation "androidx.cardview:cardview:$rootProject.supportLibraryVersion"
implementation "com.google.android.material:material:$rootProject.supportLibraryVersion"
implementation "androidx.vectordrawable:vectordrawable:$rootProject.supportLibraryVersion"
implementation "androidx.vectordrawable:vectordrawable-animated:$rootProject.supportLibraryVersion"
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

// firebase
implementation "com.google.firebase:firebase-messaging:17.6.0"
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'

// image
implementation 'com.squareup.picasso:picasso:2.71828'

// parser
implementation "com.squareup.moshi:moshi:1.8.0"
implementation "com.squareup.retrofit2:converter-moshi:2.4.0"
kapt "com.squareup.moshi:moshi-kotlin-codegen:1.8.0"
implementation 'com.squareup.moshi:moshi-adapters:1.8.0'

// dependency injection
implementation "com.google.dagger:dagger:$rootProject.dagger2Version"
kapt "com.google.dagger:dagger-compiler:$rootProject.dagger2Version"
kapt "com.google.dagger:dagger-android-processor:$rootProject.dagger2Version"
implementation "com.google.dagger:dagger-android-support:$rootProject.dagger2Version"

// reactive
implementation "io.reactivex.rxjava2:rxjava:$rootProject.rxjava2Version"
implementation "io.reactivex.rxjava2:rxandroid:$rootProject.rxandroidVersion"

// networking
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'

// logger
implementation 'com.squareup.okhttp3:logging-interceptor:3.8.0'

// other
implementation "androidx.lifecycle:lifecycle-extensions:$rootProject.lifecycle"
kapt "androidx.lifecycle:lifecycle-compiler:$rootProject.lifecycle"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.android.gms:play-services-oss-licenses:16.0.2'
implementation 'nl.dionsegijn:konfetti:1.1.2'
implementation 'com.stripe:stripe-android:11.0.1'

// dependencies for local unit tests
testImplementation "junit:junit:$rootProject.ext.junitVersion"
testImplementation "org.mockito:mockito-core:$rootProject.mockitoVersion"
testAnnotationProcessor "com.google.dagger:dagger-compiler:$rootProject.dagger2Version"

// UI Testing
androidTestImplementation "androidx.test.espresso:espresso-core:$rootProject.espressoVersion"
androidTestImplementation "androidx.test.espresso:espresso-intents:$rootProject.espressoVersion"
androidTestImplementation "org.mockito:mockito-core:$rootProject.mockitoVersion"
androidTestAnnotationProcessor "com.google.dagger:dagger-compiler:$rootProject.dagger2Version"`

@tudorsirbu what versions of Android Gradle Plugin and Gradle are you using? Can you share your Proguard config for the Stripe SDK?

@tudorsirbu for what it's worth, I haven't heard about this issue from other users either. It seems likely that there's some conflict between your configuration and the challenge screen layout in our 3DS2 library.

You can find both files attached.
build.txt
proguard-rules.txt

Not sure if it's of any help but I've got this video of the crash happening: https://youtu.be/WfMg7ktdyvM

I've tried updating different dependencies we use to see if it will fix it but nothing worked so far.

@tudorsirbu can you try the latest version, 11.0.4?

@tudorsirbu please reopen if the latest version doesn't resolve the issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

GuillaumeWrobel picture GuillaumeWrobel  路  8Comments

odedharth picture odedharth  路  10Comments

andrewmunn picture andrewmunn  路  4Comments

ahqmrf picture ahqmrf  路  8Comments

Petrulak picture Petrulak  路  5Comments