pikaju / flutter-braintree

Flutter plugin that wraps the native Braintree SDKs. Enables payments with credit cards, PayPal, Google Pay and more.
https://pub.dev/packages/flutter_braintree
MIT License
64 stars 126 forks source link

flutter briantree version 4.0.0 crash in android #158

Open TuanMai777 opened 5 months ago

TuanMai777 commented 5 months ago

Hello, I am using flutter version 4.0.0 I am using method final request = BraintreeCreditCardRequest( cardNumber: '4111111111111111', expirationMonth: '12', expirationYear: '2021', cvv: '123', ); final result = await Braintree.tokenizeCreditCard( tokenizationKey, request, );

I got the error below,

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(error, Unable to find explicit activity class {com.your-company.your-app/com.example.flutter_braintree.FlutterBraintreeCustom}; have you declared this activity in your AndroidManifest.xml, or does your intent not match its declared ?, null, android.content.ActivityNotFoundException: Unable to find explicit activity class {com.your-company.your-app/com. example.flutter_braintree.FlutterBraintreeCustom}; have you declared this activity in your AndroidManifest.xml, or does your intent not match its declared ?

BunnyBuddy commented 5 months ago

In your code (if you have this as an external dependency) at this location,

flutter-braintree/android/src/main/AndroidManifest.xml

replace the code under application tag to below,

<application>
    <activity android:name=".FlutterBraintreeCustom"
        android:exported="true"
        android:theme="@style/bt_transparent_activity">
    </activity>
    <activity android:name=".DropInActivity"
        android:theme="@style/bt_transparent_activity">
    </activity>
</application>

And then do (for android studio) flutter clean invalidate cache and restart

TuanMai777 commented 5 months ago

Hi @BunnyBuddy

I ran the code with the example given in the plugin but the app crashed with paypal When I click the "PAYPAL VAULT FLOW" button Then go to the "checkout.paypal.com" screen I clicked the blue button "Proceed with Sandbox Purchase" The app crashes with the error given

Worker result FAILURE for Work [ id=454e0e52-d3a8-4109-8625-dcf1661ded4d, tags={ com.braintreepayments.api.AnalyticsUploadWorker } ] D/AndroidRuntime(31400): Shutting down VM E/AndroidRuntime(31400): FATAL EXCEPTION: main E/AndroidRuntime(31400): Process: com.example.flutter_braintree_example, PID: 31400 E/AndroidRuntime(31400): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.flutter_braintree_example/com.braintreepayments.api.DropInActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.os.Bundle.setClassLoader(java.lang.ClassLoader)' on a null object reference

image

image

TuanMai777 commented 5 months ago

Hi @BunnyBuddy The issue will probably be the same https://github.com/pikaju/flutter-braintree/issues/153