Skip to content

Crash in production with MissingPluginException(No implementation found for method onPlaceholderChanged on channel flutter.stripe/card_field/1) #1186

Closed
@hed5meg

Description

@hed5meg

Everything works fine for me on my physical Android device with my production build, but I saw a crash report from a user and I can't figure out why or how to reproduce.

MissingPluginException(No implementation found for method onPlaceholderChanged on channel flutter.stripe/card_field/1)

I can trigger the onPlaceholderChanged invocation in the emulator, but it the method exists for me and is called fine.

I have checked all my styles.xml files as my best guess was that the device in production was running in dark mode or something, there are 3 of them (pasted below). All of them use Theme.MaterialComponents.DayNight

v31/styles/xml

<?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 off -->
    <style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
        <item name="android:forceDarkAllowed">false</item>
        <item name="android:windowFullscreen">false</item>
        <item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
        <item name="android:windowSplashScreenBackground">#8757E5</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. -->
    <!-- For stripe the theme needs to be a descendant of Theme.AppCompat -->
    <style name="NormalTheme" parent="Theme.MaterialComponents.DayNight">
        <item name="android:windowBackground">?android:colorBackground</item>
    </style>
</resources>

night-v31/styles.xml

<?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 off -->
    <style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
        <item name="android:forceDarkAllowed">false</item>
        <item name="android:windowFullscreen">false</item>
        <item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
        <item name="android:windowSplashScreenBackground">#8757E5</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. -->
    <!-- For stripe the theme needs to be a descendant of Theme.AppCompat -->
    <style name="NormalTheme" parent="Theme.MaterialComponents.DayNight">
        <item name="android:windowBackground">?android:colorBackground</item>
    </style>
</resources>

values/styles.xml


<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- Theme applied to the Android Window while the process is starting -->
    <style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
        <!-- 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:forceDarkAllowed">false</item>
        <item name="android:windowFullscreen">false</item>
        <item name="android:windowLayoutInDisplayCutoutMode">shortEdges</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. -->
    <!-- For stripe the theme needs to be a descendant of Theme.AppCompat -->
    <style name="NormalTheme" parent="Theme.MaterialComponents.DayNight">
        <item name="android:windowBackground">?android:colorBackground</item>
    </style>
</resources>

Versions

flutter_stripe-7.0.0
ext.kotlin_version = '1.7.0'

MainActivity

import io.flutter.embedding.android.FlutterFragmentActivity

//updating to be flutterfragment activity to support stripe sdk
// see https://pub.dev/packages/flutter_stripe
class MainActivity : FlutterFragmentActivity()

Crash occurred on:

Google Pixel 7
API 33

Exception:

MissingPluginException(No implementation found for method onPlaceholderChanged on channel flutter.stripe/card_field/1)

When the exception was thrown, this was the stack:
0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:313:0)

Flutter Doctor

[✓] Flutter (Channel stable, 3.7.6, on macOS 12.6 21G115 darwin-x64, locale en-US)
• Flutter version 3.7.6 on channel stable
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 12cb4eb7a0 (3 weeks ago), 2023-03-01 10:29:26 -0800
• Engine revision ada363ee93
• Dart version 2.19.3
• DevTools version 2.20.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK
• Platform android-33, build-tools 33.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14C18
• CocoaPods version 1.12.0

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] Connected device (4 available)
• sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 13 (API 33) (emulator)
• iphone 13 mini (mobile) • DA99FB56-06D7-4C52-8CF4-DF4BE260EF56 • ios • com.apple.CoreSimulator.SimRuntime.iOS-16-2 (simulator)
• macOS (desktop) • macos • darwin-x64 • macOS 12.6 21G115 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 111.0.5563.110

[✓] HTTP Host Availability
• All required HTTP hosts are available

• No issues found!
Process finished with exit code 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions