Support: Android initialization error: PlatformException(flutter_stripe initialization failed) #538
Replies: 67 comments 83 replies
-
Hi I'm unable to make it work on android. It was working perfectly with version 2.1.0, but know it is not with 2.1.1. I tried downgrading but no result. My styles are exactly the same as the examples. The error I get is as soon as the app starts, the moment I apply the settings: [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(flutter_stripe initialization failed, The plugin failed to initialize: |
Beta Was this translation helpful? Give feedback.
-
please help me. |
Beta Was this translation helpful? Give feedback.
-
Ok I solved my issue, I leave it here in case someone is having the same problem. It was my mistake, I'm using flavors in my project, so I have a dev folder inside "android/app/src" called "dev" that gets copied to replace the "android/app/src/main/res" folder with dev assets, among them there was new styles.xml So I had to update does files also to the theme requested by Stripe. A simple thing to forget. Hope it helps someone. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
hello, I installed flutter_stripe package and everything is working fine, but while uing cardfield(), if i go back with navigator.pop(context) it says 'java.lang.RuntimeException: Error during attachToGLContext' and app is closing, how to solve this error, it happens only when i use cardfield. |
Beta Was this translation helpful? Give feedback.
-
I'm facing an issue with a few of my Android users, it seems to be random and I'm unable to reproduce in the devices I try.
Here is what I have on my app/main/res/values/styles.xml, which seems okay when I compare to the example in this repository. <?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="LaunchTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<style name="NormalTheme" parent="Theme.MaterialComponents">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources> Have I forgotten something or is anyone else facing the same issue? |
Beta Was this translation helpful? Give feedback.
-
Any update on this one? |
Beta Was this translation helpful? Give feedback.
-
flutter_stripe: ^2.4.0 Still same error after whole day search. please update any solution. even 100% follow the steps. `e: C:\flutter.pub-cache\hosted\pub.dartlang.org\stripe_android-2.4.0\android\src\main\kotlin\com\flutter\stripe\StripeSdkGooglePayButtonPlatformViewFactory.kt: (13, 1): Class 'StripeSdkGooglePayButtonPlatformViewFactory' is not abstract and does not implement abstract base class member public abstract fun create(p0: Context?, p1: Int, p2: Any?): PlatformView defined in io.flutter.plugin.platform.PlatformViewFactory FAILURE: Build failed with an exception.
|
Beta Was this translation helpful? Give feedback.
-
FAILURE: Build failed with an exception. What went wrong: |
Beta Was this translation helpful? Give feedback.
-
Found solution : change ndkVersion "23.1.7779620" instead ndkVersion flutter.ndkVersion environment: sdk: ">=2.16.2 <3.0.0" |
Beta Was this translation helpful? Give feedback.
-
Hi, I am getting the same error on Android over and over again. I have followed every step at the readme. Error on build timeFAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processProductionDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
> Android resource linking failed
ERROR:AAPT: error: resource style/Theme.AppCombat.Light.NoActionBar (aka app.diven:style/Theme.AppCombat.Light.NoActionBar) not found.
error: resource style/Theme.AppCombat.Light.NoActionBar (aka app.diven:style/Theme.AppCombat.Light.NoActionBar) not found.
error: failed linking references.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 58s
Exception: Gradle task assembleProductionDebug failed with exit code 1 Flutter doctorDoctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.10.5, on macOS 11.6 20G165 darwin-x64, locale es-ES)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.0)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] VS Code (version 1.66.2)
[✓] Connected device (2 available)
[✓] HTTP Host Availability
• No issues found! styles.xmlI have 3 flavors:
values/ folder: <?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting -->
<style name="LaunchTheme" parent="Theme.AppCombat.Light.NoActionBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
<item name="android:windowFullscreen">false</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="Theme.MaterialComponents">
<item name="android:windowBackground">@android:color/white</item>
</style>
</resources> values-night/ folder: <?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
<style name="LaunchTheme" parent="Theme.AppCombat.Light.NoActionBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
<item name="android:windowFullscreen">false</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="Theme.MaterialComponents">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources> MainActivity.ktpackage com.example.divenApp
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.android.FlutterFragmentActivity
class MainActivity: FlutterFragmentActivity() {
}
android > build.gradlebuildscript {
ext.kotlin_version = '1.5.10'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.8'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
} Can you help me? If there is any missing information I could add lmk EDIT: Solution on my comment below |
Beta Was this translation helpful? Give feedback.
-
FAILURE: Build failed with an exception. What went wrong: Flutter version : 3.0 |
Beta Was this translation helpful? Give feedback.
-
try this |
Beta Was this translation helpful? Give feedback.
-
changes values-v31 -> Theme.MaterialComponents its working for me |
Beta Was this translation helpful? Give feedback.
-
I have found solution it might not work changing only values/styles.xml |
Beta Was this translation helpful? Give feedback.
-
showing me this error |
Beta Was this translation helpful? Give feedback.
-
A problem occurred configuring root project 'android'.
pls help me with this error |
Beta Was this translation helpful? Give feedback.
-
Hi, i'm trying to integrate Stripe to my flutter project and i have several questions and also several problems, which i don't know how to fix. I also have a question, is it possible not to use CardField and for example, I have my own fields, https://docs.stripe.com/js/tokens/create_token?type=cardElement If u have some examples or know how to help me, please feel free to contact with me, thx |
Beta Was this translation helpful? Give feedback.
-
Hello, I am encountering an issue with the Environment:
Code Snippet: CardFormField(
enablePostalCode: false,
controller: CardFormEditController(),
) |
Beta Was this translation helpful? Give feedback.
-
Please I need an assistance, because I have been getting:
|
Beta Was this translation helpful? Give feedback.
-
HI! I am having this issue: bad class file: C:\Users\XXXXX\StudioProjects\XXXX\build\stripe_android\intermediates\compile_library_classes_jar\debug\bundleLibCompileToJarDebug\classes.jar(com/flutter/stripe/StripeAndroidPlugin.class) |
Beta Was this translation helpful? Give feedback.
-
hey i just build my flutter application i add the stripe package it work paerfecly but the problem i didn't know how to make it is i use express js for my backend and i don't know really how to connect or make the integration using these two implementation is there anyone who make it with also using the webhooks |
Beta Was this translation helpful? Give feedback.
-
Please Help !! |
Beta Was this translation helpful? Give feedback.
-
I'm having this problem, please assist. |
Beta Was this translation helpful? Give feedback.
-
Your Main Activity class io.flutter.embedding.android.FlutterActivity is not a subclass FlutterFragmentActivity |
Beta Was this translation helpful? Give feedback.
-
Hi, i have some trouble. Do you guy's have any idea ?
Thank you in advance |
Beta Was this translation helpful? Give feedback.
-
i have this error : I/flutter (10293): Error while creating payment method: PlatformException(flutter_stripe initialization failed, The plugin failed to initialize: this is my styles :
and this is my manifest :
but i still cant work Stripe , any suggestion? |
Beta Was this translation helpful? Give feedback.
-
I have the same problem and i have solved this by this way, and this worked for me my style are
`
|
Beta Was this translation helpful? Give feedback.
-
Execution failed for task ':stripe_android:compileDebugJavaWithJavac'.
plugins { |
Beta Was this translation helpful? Give feedback.
-
Please i need help fixing this. My android app crashes after completing a successful payment. i am using flutter_stripe: ^11.2.0 |
Beta Was this translation helpful? Give feedback.
-
Are you having trouble making the Flutter Stripe work on Android? This discussion is to give support for this specific problem.
We are aware that the process is a bit more complex than desired but it is out of our hands here.
Please make sure you check again and follow all the steps in the readme before posting here.
Beta Was this translation helpful? Give feedback.
All reactions