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

Error building example android app bundle #1546

Closed
VictorUvarov opened this issue Dec 13, 2023 · 17 comments
Closed

Error building example android app bundle #1546

VictorUvarov opened this issue Dec 13, 2023 · 17 comments
Labels
needs triage Needs triage

Comments

@VictorUvarov
Copy link

Describe the bug
Error building android app bundle. Missing classes

To Reproduce
Steps to reproduce the behavior:

  1. Go to example app
  2. Add stripe publishable key
  3. run flutter build appbundle

Expected behavior
The appbundle should build with no missing class errors

Smartphone / tablet

  • Device: N/A
  • OS: Android 13
  • Package version: 9.6.0
  • Flutter version 3.16.3

Additional context
Before adding to android/app/build.gradle I get the following error

implementation 'com.stripe:stripe-android-issuing-push-provisioning:1.1.0'
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
ERROR: Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in .../build/app/outputs/mapping/devRelease/missing_rules.txt.
ERROR: R8: Missing class com.stripe.android.pushProvisioning.PushProvisioningActivity$g (referenced from: void com.reactnativestripesdk.pushprovisioning.PushProvisioningProxy$createActivityEventListener$listener$1.onActivityResult(android.app.Activity, int, int, android.content.Intent))
Missing class com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Args (referenced from: void com.reactnativestripesdk.pushprovisioning.DefaultPushProvisioningProxy.beginPushProvisioning(android.app.Activity, java.lang.String, com.reactnativestripesdk.pushprovisioning.EphemeralKeyProvider))
Missing class com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Error (referenced from: void com.reactnativestripesdk.pushprovisioning.PushProvisioningProxy$createActivityEventListener$listener$1.onActivityResult(android.app.Activity, int, int, android.content.Intent))
Missing class com.stripe.android.pushProvisioning.PushProvisioningActivityStarter (referenced from: void com.reactnativestripesdk.pushprovisioning.DefaultPushProvisioningProxy.beginPushProvisioning(android.app.Activity, java.lang.String, com.reactnativestripesdk.pushprovisioning.EphemeralKeyProvider))
Missing class com.stripe.android.pushProvisioning.PushProvisioningEphemeralKeyProvider (referenced from: void com.reactnativestripesdk.pushprovisioning.DefaultPushProvisioningProxy.beginPushProvisioning(android.app.Activity, java.lang.String, com.reactnativestripesdk.pushprovisioning.EphemeralKeyProvider) and 1 other context)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:minifyDevReleaseWithR8'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.R8Task$R8Runnable
   > Compilation failed to complete

* 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 2m 29s

and then I get another error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkReleaseDuplicateClasses'.
> Could not resolve all files for configuration ':app:releaseRuntimeClasspath'.
   > Could not find com.google.android.gms:play-services-tapandpay:17.1.2.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-tapandpay/17.1.2/play-services-tapandpay-17.1.2.pom
       - https://repo.maven.apache.org/maven2/com/google/android/gms/play-services-tapandpay/17.1.2/play-services-tapandpay-17.1.2.pom
       - https://storage.googleapis.com/download.flutter.io/com/google/android/gms/play-services-tapandpay/17.1.2/play-services-tapandpay-17.1.2.pom
     Required by:
         project :app > com.stripe:stripe-android-issuing-push-provisioning:1.1.0

* 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 7s

@VictorUvarov VictorUvarov added the needs triage Needs triage label Dec 13, 2023
@AbdullahChauhan
Copy link

+1
Just got the same error while creating the release build.

@VictorUvarov
Copy link
Author

@remonh87
Does this comment have anything to do with it

@AbdullahChauhan
Copy link

@remonh87 Does this comment have anything to do with it

@VictorUvarov Can you confirm if the build successful after including this?

@VictorUvarov
Copy link
Author

The build is not successful after adding the dependency as an implementation

@AbdullahChauhan
Copy link

Ok. Any other solution you found regarding this?

@computerfriendlog2
Copy link

I'm using
flutter 3.17.0
ext.kotlin_version = '1.9.20'
minSdkVersion 21
targetSdkVersion 34
#flutter_stripe: ^9.6.0

previously it was working fine. I don't know What happened to its not working since last week

getting below error.

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':stripe_android:compileDebugJavaWithJavac'.

error: invalid source release: 17

  • 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.

BUILD FAILED in 1m 55s
Error: Gradle task assembleDebug failed with exit code 1

@AbdullahChauhan
Copy link

@computerfriendlog2 You need to migrate to JDK 17.

@MyBlueford16
Copy link

I'm running into the same issue as well
Any solution? @AbdullahChauhan @VictorUvarov

@nicholasalexanderchambers
Copy link

nicholasalexanderchambers commented Dec 16, 2023

You can try adding

        minifyEnabled false
        shrinkResources false

to your release buildtype in gradle. Not smart for production builds since it'll disable obfuscation, but good enough for just the example app.

@MyBlueford16
Copy link

You can try adding

        minifyEnabled false
        shrinkResources false

to your release buildtype in gradle. Not smart for production builds since it'll disable obfuscation, but good enough for just the example app.

It does get the build to work, but like you said, not very ideal for a production build...

@mcmikashi
Copy link

Don't know if this good practice, but I add this on android/app/build.gradle:

`    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
        }
    }`

and add android/app/proguard-rules.pro with this :

`# Please add these rules to your existing keep rules in order to suppress warnings.
# This is generated automatically by the Android Gradle plugin.
-dontwarn com.google.android.gms.tapandpay.TapAndPayClient
`

@VictorUvarov
Copy link
Author

@remonh87 Any ideas?

@remonh87
Copy link
Member

add the following to your proguard files solves the issue. will document this in the troubleshoot settings of the app + readme

-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivity$g
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Args
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Error
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningEphemeralKeyProvider

@remonh87
Copy link
Member

See: fb10f16 for how to implement

remonh87 added a commit that referenced this issue Dec 19, 2023
* doc: fix #1532 broken link in readme

* chore(release): publish packages

 - [email protected]

* fix: #1512 add latest charge field to payment intent (Web only)

* doc: fix #1488 add nscamerausagedescription to readme

* BREAKING: rename ApplePayShippingContact to Platformpayshipping contact

* doc: #1546 add proguard rules for push provisioning

* fix: #1465 unknow result

* doc: add  klarna as return url for paymentsheet

* fix #1560

* adjust github android workflow

* chore(release): publish packages

 - [email protected]

* chore(release): publish packages

 - [email protected]

* chore(release): publish packages

 - [email protected]

* chore(release): publish packages

 - [email protected]

* chore(release): publish packages

 - [email protected]

* chore: update changelogs

---------

Co-authored-by: Remon <[email protected]>
Co-authored-by: Jonas Bark <[email protected]>
@claudiooliveira
Copy link

I created the proguard-rules.pro file and it still has the same error

# Please add these rules to your existing keep rules in order to suppress warnings.
# This is generated automatically by the Android Gradle plugin.
-dontwarn com.google.android.gms.tapandpay.TapAndPayClient
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivity$g
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Args
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Error
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningEphemeralKeyProvider

Error:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkQaReleaseAarMetadata'.
> Could not resolve all files for configuration ':app:qaReleaseRuntimeClasspath'.
   > Could not find com.google.android.gms:play-services-tapandpay:17.1.2.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-tapandpay/17.1.2/play-services-tapandpay-17.1.2.pom
       - https://repo.maven.apache.org/maven2/com/google/android/gms/play-services-tapandpay/17.1.2/play-services-tapandpay-17.1.2.pom
       - https://storage.googleapis.com/download.flutter.io/com/google/android/gms/play-services-tapandpay/17.1.2/play-services-tapandpay-17.1.2.pom
       - https://jitpack.io/com/google/android/gms/play-services-tapandpay/17.1.2/play-services-tapandpay-17.1.2.pom
     Required by:
         project :app > com.stripe:stripe-android-issuing-push-provisioning:1.1.0

* 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.

@claudiooliveira
Copy link

@remonh87 should using the proguard-rules file solve this?

My build.gradle:

buildTypes {
       release {
           // TODO: Add your own signing config for the release build.
           // Signing with the debug keys for now, so `flutter run --release` works.
           signingConfig signingConfigs.debug
           proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
       }
   }

@black10manda
Copy link

I created the proguard-rules.pro file and it still has the same error

# Please add these rules to your existing keep rules in order to suppress warnings.
# This is generated automatically by the Android Gradle plugin.
-dontwarn com.google.android.gms.tapandpay.TapAndPayClient
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivity$g
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Args
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Error
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningEphemeralKeyProvider

Error:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkQaReleaseAarMetadata'.
> Could not resolve all files for configuration ':app:qaReleaseRuntimeClasspath'.
   > Could not find com.google.android.gms:play-services-tapandpay:17.1.2.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-tapandpay/17.1.2/play-services-tapandpay-17.1.2.pom
       - https://repo.maven.apache.org/maven2/com/google/android/gms/play-services-tapandpay/17.1.2/play-services-tapandpay-17.1.2.pom
       - https://storage.googleapis.com/download.flutter.io/com/google/android/gms/play-services-tapandpay/17.1.2/play-services-tapandpay-17.1.2.pom
       - https://jitpack.io/com/google/android/gms/play-services-tapandpay/17.1.2/play-services-tapandpay-17.1.2.pom
     Required by:
         project :app > com.stripe:stripe-android-issuing-push-provisioning:1.1.0

* 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.

use
buildTypes {
release {
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Needs triage
Projects
None yet
Development

No branches or pull requests

9 participants