IllegalStateException instantiating DropInClient in started activity
See original GitHub issueGeneral information
- SDK/Library version: 6.1.0
- Environment: sandbox
- Android Version and Device: any
Issue description
I’m trying to upgrade to version 6.1.0 where the constructor DropInClient(Context, String, DropInRequest) is deprecated. However, new constructors throw
java.lang.IllegalStateException: LifecycleOwner [omissis].MainActivity@4e33d58 is attempting to register while current state is RESUMED. LifecycleOwners must call register before they are STARTED.
at androidx.activity.result.ActivityResultRegistry.register(ActivityResultRegistry.java:123)
at com.braintreepayments.api.DropInLifecycleObserver.onCreate(DropInLifecycleObserver.java:30)
at androidx.lifecycle.FullLifecycleObserverAdapter.onStateChanged(FullLifecycleObserverAdapter.java:36)
at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.java:354)
at androidx.lifecycle.LifecycleRegistry.addObserver(LifecycleRegistry.java:196)
at com.braintreepayments.api.DropInClient.addObserver(DropInClient.java:175)
at com.braintreepayments.api.DropInClient.<init>(DropInClient.java:169)
at com.braintreepayments.api.DropInClient.<init>(DropInClient.java:126)
[...]
when the referenced FragmentActivity is already started, which wasn’t the case with the deprecated constructor. I can’t instantiate the client before in the activity, since I don’t have all the details from the user to construct the DropInRequest, unless I launch a dedicated one (which I’d prefer not to). Is this the intended behaviour?
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Problems with initializing ThreeDSecureClient #541 - GitHub
You must instantiate the DropInClient in onCreate to allow your application to recover in case a process kill has occurred, and your Activity/ ......
Read more >java.lang.RuntimeException: Unable to instantiate activity ...
RuntimeException: Unable to instantiate activity ComponentInfo exception and that is the activity that you are trying to start is abstract.
Read more >Braintree Drop-In SDK for Android - AndroidRepo
To launch Drop-in, instantiate a DropInClient with client ... IllegalStateException: Fragment must be attached to an activity. at ...
Read more >Braintree Drop-In SDK for Android - AndroidRepo
To launch Drop-in, instantiate a DropInClient with client authorization and call ... IllegalStateException: Fragment must be attached to an activity. at ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @mtrakal we do have a pull request #358 up to make this change. We’re doing our due diligence to get it merged in. We don’t have an expected timeline on completion, but I’d expect it to be available in the next release.
Also feel free to review the PR!
Hi, is there any progress in move
DropInRequest
tostart()
orlaunchDropIn()
method?