stripe / stripe-android

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

java.lang.RuntimeException: Parcelable encountered IOException writing serializable object (name = com.stripe.android.exception.PermissionException) #2092

Closed tuclicks closed 4 years ago

tuclicks commented 4 years ago

Summary

Crash on

 stripe?.confirmPayment(this, ConfirmPaymentIntentParams.createWithPaymentMethodId(methodId, secret, RETURN_URL, true))

Android version

Android 9, API 28

Impacted devices

Samsung Galaxy S8

Installation method

Gradle

SDK version

com.stripe:stripe-android:13.1.0

Other information

I feel very similar to this problem

Call this only if less than kitkat

if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
        try {
            //playstoreからtlsをインストール
            ProviderInstaller.installIfNeeded(HelloworkApplication.application)
        } catch (e: GooglePlayServicesRepairableException) {
            e.printStackTrace()
            GoogleApiAvailability.getInstance()
                    .showErrorNotification(HelloworkApplication.application, e.connectionStatusCode)
        }
    }

Security.getProviders()

2020-01-24 00:06:02.715 16463-16463/info.*.* I/*: PROVIDER  AndroidNSSP version 1.0
2020-01-24 00:06:02.715 16463-16463/info.*.* I/*: PROVIDER  AndroidOpenSSL version 1.0
2020-01-24 00:06:02.715 16463-16463/info.*.*I/*: PROVIDER   CertPathProvider version 1.0
2020-01-24 00:06:02.716 16463-16463/info.*.*I/*: PROVIDER   AndroidKeyStoreBCWorkaround version 1.0
2020-01-24 00:06:02.716 16463-16463/info.*.*I/*: PROVIDER   BC version 1.57
2020-01-24 00:06:02.716 16463-16463/info.*.*I/*: PROVIDER   HarmonyJSSE version 1.0
2020-01-24 00:06:02.717 16463-16463/info.*.*I/*: PROVIDER   AndroidKeyStore version 1.0
2020-01-24 00:06:02.717 16463-16463/info.*.*I/*: PROVIDER   KnoxAndroidKeyStore version 1.0
2020-01-24 00:06:02.717 16463-16463/info.*.*I/*: PROVIDER   TimaKeyStore version 1.0

This is Error log

2020-01-23 23:54:43.684 14260-14696/info.*.* E/AndroidRuntime: FATAL EXCEPTION: DefaultDispatcher-worker-2
    Process: info.*.*, PID: 14260
    java.lang.RuntimeException: Parcelable encountered IOException writing serializable object (name = com.stripe.android.exception.PermissionException)
        at android.os.Parcel.writeSerializable(Parcel.java:1730)
        at android.os.Parcel.writeValue(Parcel.java:1678)
        at android.os.Parcel.writeArrayMapInternal(Parcel.java:891)
        at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1579)
        at android.os.Bundle.writeToParcel(Bundle.java:1233)
        at android.os.Parcel.writeBundle(Parcel.java:931)
        at android.content.Intent.writeToParcel(Intent.java:10643)
        at android.app.IActivityManager$Stub$Proxy.startActivity(IActivityManager.java:3593)
        at android.app.Instrumentation.execStartActivity(Instrumentation.java:1669)
        at android.app.Activity.startActivityForResult(Activity.java:4689)
        at androidx.fragment.app.FragmentActivity.startActivityForResult(FragmentActivity.java:676)
        at android.app.Activity.startActivityForResult(Activity.java:4647)
        at androidx.fragment.app.FragmentActivity.startActivityForResult(FragmentActivity.java:663)
        at com.stripe.android.view.AuthActivityStarter$Host.startActivityForResult$stripe_release(AuthActivityStarter.kt:33)
        at com.stripe.android.PaymentRelayStarter$Companion$create$1.start(PaymentRelayStarter.kt:33)
        at com.stripe.android.PaymentRelayStarter$Companion$create$1.start(PaymentRelayStarter.kt:21)
        at com.stripe.android.StripePaymentController$Companion.handleError(StripePaymentController.kt:906)
        at com.stripe.android.StripePaymentController$Companion.access$handleError(StripePaymentController.kt:845)
        at com.stripe.android.StripePaymentController$ConfirmStripeIntentCallback.onError(StripePaymentController.kt:549)
        at com.stripe.android.ApiOperation.dispatchResult(ApiOperation.kt:40)
        at com.stripe.android.ApiOperation.access$dispatchResult(ApiOperation.kt:13)
        at com.stripe.android.ApiOperation$execute$1$1.invokeSuspend(ApiOperation.kt:32)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7050)
        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:965)
     Caused by: java.io.NotSerializableException: com.stripe.android.StripeError
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1240)
        at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1604)
        at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1565)
        at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1488)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1234)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:354)
        at android.os.Parcel.writeSerializable(Parcel.java:1725)
        at android.os.Parcel.writeValue(Parcel.java:1678) 
        at android.os.Parcel.writeArrayMapInternal(Parcel.java:891) 
        at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1579) 
        at android.os.Bundle.writeToParcel(Bundle.java:1233) 
        at android.os.Parcel.writeBundle(Parcel.java:931) 
        at android.content.Intent.writeToParcel(Intent.java:10643) 
        at android.app.IActivityManager$Stub$Proxy.startActivity(IActivityManager.java:3593) 
        at android.app.Instrumentation.execStartActivity(Instrumentation.java:1669) 
        at android.app.Activity.startActivityForResult(Activity.java:4689) 
        at androidx.fragment.app.FragmentActivity.startActivityForResult(FragmentActivity.java:676) 
        at android.app.Activity.startActivityForResult(Activity.java:4647) 
        at androidx.fragment.app.FragmentActivity.startActivityForResult(FragmentActivity.java:663) 
        at com.stripe.android.view.AuthActivityStarter$Host.startActivityForResult$stripe_release(AuthActivityStarter.kt:33) 
        at com.stripe.android.PaymentRelayStarter$Companion$create$1.start(PaymentRelayStarter.kt:33) 
        at com.stripe.android.PaymentRelayStarter$Companion$create$1.start(PaymentRelayStarter.kt:21) 
        at com.stripe.android.StripePaymentController$Companion.handleError(StripePaymentController.kt:906) 
        at com.stripe.android.StripePaymentController$Companion.access$handleError(StripePaymentController.kt:845) 
        at com.stripe.android.StripePaymentController$ConfirmStripeIntentCallback.onError(StripePaymentController.kt:549) 
        at com.stripe.android.ApiOperation.dispatchResult(ApiOperation.kt:40) 
        at com.stripe.android.ApiOperation.access$dispatchResult(ApiOperation.kt:13) 
        at com.stripe.android.ApiOperation$execute$1$1.invokeSuspend(ApiOperation.kt:32) 
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) 
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56) 
        at android.os.Handler.handleCallback(Handler.java:873) 
        at android.os.Handler.dispatchMessage(Handler.java:99) 
        at android.os.Looper.loop(Looper.java:214) 
        at android.app.ActivityThread.main(ActivityThread.java:7050) 
        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:965) 

part of Gradle

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

apply plugin: 'kotlin-kapt'

apply plugin: 'io.fabric'

android {
compileSdkVersion 28
    defaultConfig {
        applicationId "***"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode **
        versionName "***"
        multiDexEnabled true
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        setProperty("archivesBaseName", "$applicationId-$versionName")
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
    }
    //これを書かないとjava8でビルドしてしまうため、sdk26以上じゃないと動かなくなる
    compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }
}
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    //support
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.preference:preference:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.1.0'

    //firebase
    implementation 'com.google.firebase:firebase-core:17.2.2'
    implementation 'com.google.firebase:firebase-analytics:17.2.2'
    implementation 'com.google.firebase:firebase-auth:19.2.0'
    implementation 'com.google.firebase:firebase-storage:19.1.0'
    implementation 'com.google.firebase:firebase-firestore:21.3.1'
    implementation 'com.google.firebase:firebase-functions:19.0.1'
    implementation 'com.google.firebase:firebase-messaging:20.1.0'
    implementation 'com.google.firebase:firebase-inappmessaging-display:19.0.3'
    implementation 'com.google.firebase:firebase-ads:18.3.0'
    //firebase crashlytics
    implementation('com.crashlytics.sdk.android:crashlytics:2.10.1') {
        transitive = true;
    }
    //firebase ui
    implementation 'com.firebaseui:firebase-ui-firestore:6.2.0'
    implementation 'com.firebaseui:firebase-ui-storage:6.2.0'

    //stripe
    implementation 'com.stripe:stripe-android:13.1.0'

    //guava
    api 'com.google.guava:guava:28.0-android'

    //http 3.12.3 以降はAndroid5以上対象
    implementation 'com.squareup.okhttp3:okhttp:3.12.3'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.12.3'

    //event bus
    implementation 'org.greenrobot:eventbus:3.1.1'

    //retrofit
    implementation 'com.squareup.retrofit2:retrofit:2.6.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.6.0'
    implementation 'com.squareup.retrofit2:adapter-rxjava2:2.6.0'

    //rx
    implementation 'io.reactivex.rxjava2:rxjava:2.2.16'
    implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
    implementation 'io.reactivex.rxjava2:rxkotlin:2.4.0'

    //html paser
    implementation 'org.ccil.cowan.tagsoup:tagsoup:1.2.1'
    implementation 'org.jsoup:jsoup:1.12.1'

    //gson
    implementation 'com.google.code.gson:gson:2.8.5'
    //icu (和暦変換)
    implementation 'com.ibm.icu:icu4j:65.1'
    //log
    implementation 'co.trikita:log:1.1.5'

    //glide
    implementation 'com.github.bumptech.glide:glide:4.10.0'
    implementation "com.github.bumptech.glide:okhttp3-integration:4.10.0"
    kapt 'com.github.bumptech.glide:compiler:4.10.0'

    //dialog toast
    implementation 'com.afollestad.material-dialogs:core:3.1.1'
    implementation 'com.afollestad.material-dialogs:datetime:3.1.1'
    implementation 'com.github.GrenderG:Toasty:1.4.2'

    //image picker
    implementation 'com.github.qingmei2:rximagepicker:2.5.2'

    //image crop
    implementation 'com.github.yalantis:ucrop:2.2.4-native'

    //photo view
    implementation 'com.github.chrisbanes:PhotoView:2.3.0'

    //sectioing recyclerview adapter
    implementation 'org.zakariya.stickyheaders:stickyheaders:0.7.11'

    //ad
    implementation 'net.nend.android:nend-sdk:5.4.0'
    implementation 'com.google.ads.mediation:imobile:2.0.20.0'
    implementation 'com.google.ads.mediation:applovin:9.8.0.0'
}

apply plugin: 'com.google.gms.google-services'
mshafrir-stripe commented 4 years ago

@tuclicks is this something you experiencing on earlier SDK versions, or only after upgrading? Can you consistently reproduce the issue on both emulators and real devices? If you could help me narrow down the problem surface area that will help in debugging the issue.

tuclicks commented 4 years ago

I first introduced stripe into my app. We have not upgraded.

mshafrir-stripe commented 4 years ago

Can you try reproducing this issue with 13.1.2?