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

PlatformException Already Running #15

Closed
gmaxferr opened this issue Feb 13, 2020 · 1 comment
Closed

PlatformException Already Running #15

gmaxferr opened this issue Feb 13, 2020 · 1 comment

Comments

@gmaxferr
Copy link

gmaxferr commented Feb 13, 2020

PlatformException Already Running

My Question

After executing the My Code below, it blocks and if that block of code is executed once again, then the error at ERROR LOG appears...
Does anyone know what may be causing this?

NOTE: The example app runs fine on my machine & phone btw...

Flutter Doctor

flutter doctor -v
[✓] Flutter (Channel stable, v1.12.13+hotfix.7, on Linux, locale en_US.UTF-8)
    • Flutter version 1.12.13+hotfix.7 at /home/XXXXX/9360/programs/flutter
    • Framework revision 9f5ff2306b (3 weeks ago), 2020-01-26 22:38:26 -0800
    • Engine revision a67792536c
    • Dart version 2.7.0

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /home/XXXXX/9360/Android/Sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • ANDROID_HOME = /home/XXXXX/9360/Android/Sdk
    • ANDROID_SDK_ROOT = /home/XXXXX/9360/Android/Sdk
    • Java binary at: /home/XXXXX/9360/programs/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    ✗ Android license status unknown.
      Try re-installing or updating your Android SDK Manager.
      See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed instructions.

[✓] Android Studio (version 3.5)
    • Android Studio at /home/XXXXX/9360/programs/android-studio
    • Flutter plugin version 42.1.1
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[!] IntelliJ IDEA Community Edition (version 2019.2)
    • IntelliJ at /home/XXXXX/9360/programs/idea-IC-192.6262.58
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • For information about installing plugins, see
      https://flutter.dev/intellij-setup/#installing-the-plugins

[✓] VS Code (version 1.42.0)
    • VS Code at /usr/share/code
    • Flutter extension version 3.8.1

[✓] Connected device (1 available)
    • VOG L29 • 22X0219927009876 • android-arm64 • Android 10 (API 29)

! Doctor found issues in 2 categories.

Plugin Verison

On pubspec.yaml:

    flutter_braintree: ^0.5.3+1

My Code

I'm running this code (as per the example):

...
    print("1");
    final request = BraintreeCreditCardRequest(
      cardNumber: '4111111111111111',
      expirationMonth: '12',
      expirationYear: '2021',
    );
    print("2");
    BraintreePaymentMethodNonce result = await Braintree.tokenizeCreditCard(
      "<my_sandbox_tokenized_key>",
      request,
    );
    print("3"); // <- This never gets printed!!
    if (result != null) {
        ...
    }
...

The credit card is created on Braintree, but I can 't obtain the nonce afterwards.
Does anyone have any idea about this issue I'm facing?

ERROR LOG:

E/flutter (14861): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(already_running, Cannot launch another custom activity while one is already running., null)
E/flutter (14861): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:569:7)
E/flutter (14861): #1      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:321:33)
E/flutter (14861): <asynchronous suspension>
E/flutter (14861): #2      Braintree.tokenizeCreditCard (package:flutter_braintree/src/custom.dart:24:36)
E/flutter (14861): #3      _AddNewCreditCardPageState._onNextButtonAction (package:XXXXXXX/screens/payment_methods/add_credit_card.dart:173:58)
E/flutter (14861): #4      _AddNewCreditCardPageState.build.<anonymous closure> (package:XXXXXXX/screens/payment_methods/add_credit_card.dart:116:33)
E/flutter (14861): #5      _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:706:14)
E/flutter (14861): #6      _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:789:36)
E/flutter (14861): #7      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24)
E/flutter (14861): #8      TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:486:11)
E/flutter (14861): #9      BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:264:5)
E/flutter (14861): #10     BaseTapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:236:7)
E/flutter (14861): #11     GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:156:27)
E/flutter (14861): #12     GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:222:20)
E/flutter (14861): #13     GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:198:22)
E/flutter (14861): #14     GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:156:7)
E/flutter (14861): #15     GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:102:7)
E/flutter (14861): #16     GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:86:7)
E/flutter (14861): #17     _rootRunUnary (dart:async/zone.dart:1138:13)
E/flutter (14861): #18     _CustomZone.runUnary (dart:async/zone.dart:1031:19)
E/flutter (14861): #19     _CustomZone.runUnaryGuarded (dart:async/zone.dart:933:7)
E/flutter (14861): #20     _invoke1 (dart:ui/hooks.dart:273:10)
E/flutter (14861): #21     _dispatchPointerDataPacket (dart:ui/hooks.dart:182:5)

build.gradle

buildscript {
    ext.kotlin_version = '1.3.50'
     ext {
        compileSdkVersion   = 28                // or higher
        targetSdkVersion    = 28                // or higher
        minSdkVersion       = 21
        appCompatVersion    = "1.0.2"           // or higher
    }
    repositories {
        google()
        jcenter()
        maven {
           url 'https://maven.fabric.io/public'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.3'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.3'
        // classpath 'io.fabric.tools:gradle:1.30.0'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

rootProject.buildDir = '../build'

subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

app/build.gradle

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

    
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
    compileSdkVersion rootProject.ext.compileSdkVersion

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        applicationId "com.XXXXXX.XXXXXX"
        minSdkVersion rootProject.ext.minSdkVersion

        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.core:core:1.1.0'
    implementation 'com.google.firebase:firebase-messaging:20.1.0'
    // implementation 'com.google.firebase:firebase-core:17.0.1'
    // implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.2-alpha01'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.2-alpha01'
}

// apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'

AndroidManifest

(I didn't add anything on Manifest since the changes that were described in the README.MD of the project were only related to googlePay, Paypel, 3ds auth,etc And I only want Credit Cards)

@pikaju
Copy link
Owner

pikaju commented Feb 9, 2023

This issue is very old, please reopen if it still persists in the latest version.

@pikaju pikaju closed this as completed Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants