Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why does the sdk depend on RC versions of androidx artifacts? #3272

Closed
calvarez-ov opened this issue Jan 19, 2021 · 17 comments
Closed

Why does the sdk depend on RC versions of androidx artifacts? #3272

calvarez-ov opened this issue Jan 19, 2021 · 17 comments
Assignees
Labels
triaged Issue has been reviewed by Stripe and is being tracked internally

Comments

@calvarez-ov
Copy link

calvarez-ov commented Jan 19, 2021

Summary

The stripe sdk depends on unstable (release candidate) versions of some androidx artifacts. Looks like in commit 97c3ac3, for example, these versions were specified:

  • androidx fragment: 1.2.5 or maybe 1.3.0-rc01 (I see both in that commit)
  • androidx activity: 1.2.0-rc01

We prefer to stay on stable versions of libraries whenever possible.

I did try to force stable versions of these libraries with a resolutionStrategy in our project's build.gradle, and that resulted in crashes when opening the stripe UI for the card list. (java.lang.NoClassDefFoundError: Failed resolution of: androidx/activity/result/contract/ActivityResultContract;)

I don't have enough info right now to provide details of the crash.

For now:
1️⃣ I'd just like to know if there's a specific reason stripe depends on these rc versions.
2️⃣ I'd also like to request to depend on stable versions in the future, if possible.

Thanks!

SDK version

16.2.0


UPDATE: I may try to answer 1️⃣ "why" myself 😄 :

  • AddPaymentMethodContract.kt uses ActivityResultContract which is only available in the 1.2.0-rc1 version of the activity artifact.
  • By forcing our project to stay on the 1.1.0 stable version of activity, the stripe ui crashes because this class isn't available.
@mshafrir-stripe
Copy link
Collaborator

@calvarez-ov thanks for filing this issue. I'd like to apologize for the inconvenience that this release caused. We noted this dependency in our changelog, but there might be other ways of publicizing these changes. We don't have a stated policy about dependency version stability, but I agree that including an RC artifact introduces integration issues and should be avoided unless absolutely necessary.

For now, I would recommend rolling back to Stripe SDK v16.1.1.

@calvarez-ov
Copy link
Author

calvarez-ov commented Jan 20, 2021

Thanks for the response. Indeed, I missed this note in the changelog!

You can close is issue :)

Actually I prefer to keep this open. It's concerning that new updates are being made to the stripe sdk, that we can't take advantage of, unless we accept to have dependencies on unstable androidx artifacts.

@calvarez-ov
Copy link
Author

One more note: It looks like fragment 1.3.0-rc01 is also required.

If I force fragment to the latest stable (1.2.5), (but keep the 1.2.0-rc01 for activity): the app crashes when launching the activity to create a new card, from the activity with the list of cards:

Process: com.stripe.example, PID: 8488
java.lang.IllegalArgumentException: Can only use lower 16 bits for requestCode
        at androidx.fragment.app.FragmentActivity.checkForValidRequestCode(FragmentActivity.java:714)
        at androidx.fragment.app.FragmentActivity.startActivityForResult(FragmentActivity.java:672)
        at androidx.core.app.ActivityCompat.startActivityForResult(ActivityCompat.java:234)
        at androidx.activity.ComponentActivity$2.onLaunch(ComponentActivity.java:218)
        at androidx.activity.result.ActivityResultRegistry$2.launch(ActivityResultRegistry.java:162)
        at androidx.activity.result.ActivityResultLauncher.launch(ActivityResultLauncher.java:47)
        at com.stripe.android.view.PaymentMethodsActivity$onCreate$4.onChanged(PaymentMethodsActivity.kt:116)
        at com.stripe.android.view.PaymentMethodsActivity$onCreate$4.onChanged(PaymentMethodsActivity.kt:35)
        at androidx.lifecycle.LiveData.considerNotify(LiveData.java:133)
        at androidx.lifecycle.LiveData.dispatchingValue(LiveData.java:151)
        at androidx.lifecycle.LiveData.setValue(LiveData.java:309)
        at androidx.lifecycle.MutableLiveData.setValue(MutableLiveData.java:50)
        at androidx.lifecycle.Transformations$3.onChanged(Transformations.java:188)
        at androidx.lifecycle.MediatorLiveData$Source.onChanged(MediatorLiveData.java:152)
        at androidx.lifecycle.LiveData.considerNotify(LiveData.java:133)
        at androidx.lifecycle.LiveData.dispatchingValue(LiveData.java:151)
        at androidx.lifecycle.LiveData.setValue(LiveData.java:309)
        at androidx.lifecycle.MutableLiveData.setValue(MutableLiveData.java:50)
        at com.stripe.android.view.PaymentMethodsAdapter$onBindViewHolder$3.onClick(PaymentMethodsAdapter.kt:154)
        at android.view.View.performClick(View.java:7448) 
        at android.view.View.performClickInternal(View.java:7425)
        at android.view.View.access$3600(View.java:810) 
        at android.view.View$PerformClick.run(View.java:28305)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:223)      
        at android.app.ActivityThread.main(ActivityThread.java:7656)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

Maybe that should go into the release notes as well?

@calvarez-ov
Copy link
Author

calvarez-ov commented Jan 20, 2021

Also, lifecycle 2.3.0-rc01 is required. If I force it to stable 2.2.0 (but keep the rc versions for fragment and activity), I get another crash, when opening the "fragment examples":

 Process: com.stripe.example, PID: 10752
 java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/lifecycle/ViewTreeLifecycleOwner; 
        at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2957)
        at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:515)
        at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:282)
        at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2177)
        at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2088)
        at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1990)
        at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3122)
        at androidx.fragment.app.FragmentManager.dispatchActivityCreated(FragmentManager.java:3056)
        at androidx.fragment.app.FragmentController.dispatchActivityCreated(FragmentController.java:251)
        at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:473)
        at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:210)
        at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1435)
        at android.app.Activity.performStart(Activity.java:8024)
        at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3475)
        at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
        at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
        at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:223)      
        at android.app.ActivityThread.main(ActivityThread.java:7656)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
 Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.lifecycle.ViewTreeLifecycleOwner" on path: DexPathList[[zip file "/data/app/~~oR8tIM6svw3_38qSC7EmkA==/com.stripe.example-_WWkaScklKO6bP-IT1YSNg==/base.apk"],nativeLibraryDirectories=[/data/app/~~oR8tIM6svw3_38qSC7EmkA==/com.stripe.example-_WWkaScklKO6bP-IT1YSNg==/lib/x86, /system/lib, /system_ext/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        ... 25 more

Another thing to mention in the release notes perhaps?

@bendiknesbo
Copy link

bendiknesbo commented Jan 29, 2021

This is not the first time Stripe Android is pulling in non-stable dependencies :/

Version 12.7.0 (more than 1 year ago) pulled in some alpha-versions of Material: #1966

Pulling in 1.3.0-rc01 of fragment-ktx ends up pulling in release-candidate versions of:

fragment-ktx >= 1.3.0-rc01
activity-ktx >= 1.2.0-rc01
activity == [1.2.0-rc01]
fragment == [1.3.0-rc01]
lifecycle-livedata-core-ktx >= 2.3.0-rc01
lifecycle-runtime >= 2.3.0-rc01
lifecycle-common >= 2.3.0-rc01
lifecycle-viewmodel-ktx >= 2.3.0-rc01
lifecycle-viewmodel >= 2.3.0-rc01
savedstate-ktx >= 1.1.0-rc01
savedstate == [1.1.0-rc01]

Quite a few of these bring in breaking changes, as pointed out above.

@mshafrir-stripe mshafrir-stripe self-assigned this Jan 29, 2021
@mshafrir-stripe mshafrir-stripe added the triaged Issue has been reviewed by Stripe and is being tracked internally label Jan 29, 2021
@calvarez-ov
Copy link
Author

calvarez-ov commented Feb 1, 2021

I see there's a new release of the stripe sdk, 16.2.1, which has one item which could be interesting:

#3315 Upgrade 3DS2 SDK to 5.1.1

The problem is that 16.2.1 still depends on unstable versions of androidx libraries.

We would like to have the latest 3DS2 library, if it has important updates, without having to rely on unstable androidx artifacts.

@mshafrir-stripe
Copy link
Collaborator

mshafrir-stripe commented Feb 1, 2021

@calvarez-ov thanks for the feedback. I'm anticipating that a stable version will be released soon [0], which will allow you to upgrade.

[0] https://twitter.com/ianhlake/status/1354530728558489600

@westy92
Copy link
Contributor

westy92 commented Feb 10, 2021

These dependencies have graduated to stable: #3367

@calvarez-ov
Copy link
Author

Will we have a new release of Stripe, which will depend on the new stable versions of the androidx artifacts?

@mshafrir-stripe
Copy link
Collaborator

@calvarez-ov yes, planning on doing a new release with the stable artifacts today.

See changelog: #3371

@calvarez-ov
Copy link
Author

I noticed in the release notes of activity 1.2.0 :

Note: When using AppCompatActivity, you must use AppCompat 1.3.0-alpha01 or higher to gain ViewTree support.

Will the new stripe release have a direct or transitive dependency on this alpha version of app compat?

@westy92
Copy link
Contributor

westy92 commented Feb 11, 2021

@calvarez-ov It sounds like that only applies if the SDK needs to "gain ViewTree support."

@calvarez-ov
Copy link
Author

Does stripe need viewtree support?

@mshafrir-stripe
Copy link
Collaborator

@calvarez-ov no, we don't depend on ViewTree support. The latest Android SDK release will not be depending on any non-release Jetpack libraries. :)

@calvarez-ov
Copy link
Author

awesome, thanks! 🙇

@mshafrir-stripe
Copy link
Collaborator

@mshafrir-stripe
Copy link
Collaborator

Thanks for your feedback regarding the RC dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triaged Issue has been reviewed by Stripe and is being tracked internally
Projects
None yet
Development

No branches or pull requests

4 participants