Stripe-android: Could not compile when integrate into my project

Created on 25 Jun 2019  Â·  19Comments  Â·  Source: stripe/stripe-android

Error: Class content provided for type descriptor com.stripe.android.stripe3ds2.transaction.A actually defines class com.stripe.android.stripe3ds2.transaction.a

My android studio providing this error message to me, and I tried exclude com.stripe.android.stripe3ds2 but it not working at runtime stripe is depends on 3d secure.
In stripe3ds2 with class of name A and a, make me confuse

Installation method

implementation 'com.stripe:stripe-android:9.3.5'

SDK version

    compileSdkVersion = 28
triaged

Most helpful comment

@mshafrir-stripe I'm on the R8 team at Google. I think you might have been bitten by https://issuetracker.google.com/issues/129493704

I would love to make sure that we have actually fixed this issue. On the project where you disabled R8, would it be possible for you to enable R8 again and just check if the result contains class files in the same package both with lower-case and upper-case names? If that is the case, that could lead to these issues where unpacking the zip will lose classes and could probably lead to these errors.

If that is the case, can you try using android studio 3.5 RC1 to check that this is no longer the case? In particular, if you still see both the lower-case and upper-case name of some class we would love to know so we can investigate.

Sorry for the inconvenience. Let's work together on getting R8 reenabled for that dependency! :)

All 19 comments

@GHChrisSu What version of Gradle and the Android Gradle Plugin are you using? I recommend upgrading both to the latest. Are you using the Stripe Proguard rules? Are you attempting to reference that class in your code? What version of stripe-android did you upgrade from?

@mshafrir I made my Gradle and Gradle plugin same with this project. Yes, I used the Proguard rules to my project, and I didn't reference the 3ds directly, and it's my first integrate.I just use the PaymentActivity code into my project, and use the version in Readme.

For now I just use the source code and comment out the code about 3ds, and it's working temporarily

@GHChrisSu what code did you comment out? Can you provide an example?

@mshafrir-stripe A lot of I was commented out
remove the dependency of "com.stripe:stripe-3ds2-android:0.0.17"
and comment out the code about com.stripe:stripe-3ds2-android:0.0.17

cause the error is in com.stripe.android.stripe3ds2 said Class A and a seems to be repetitive

and I also use the kotlin to compile the code

Same problem here with minify enabled :

Warning: class [com/stripe/android/stripe3ds2/transaction/B.class] unexpectedly contains class [com.stripe.android.stripe3ds2.transaction.b]
Warning: class [com/stripe/android/stripe3ds2/transaction/D.class] unexpectedly contains class [com.stripe.android.stripe3ds2.transaction.d]
Warning: class [com/stripe/android/stripe3ds2/transaction/A.class] unexpectedly contains class [com.stripe.android.stripe3ds2.transaction.a]
Warning: class [com/stripe/android/stripe3ds2/transaction/C.class] unexpectedly contains class [com.stripe.android.stripe3ds2.transaction.c]
Warning: class [com/stripe/android/stripe3ds2/transaction/E.class] unexpectedly contains class [com.stripe.android.stripe3ds2.transaction.e]

My proguard config is -keep class com.stripe.android.** { *; }

Did you find any workaround?

Hey @mshafrir-stripe,

we are also facing this issue after trying to update the Stripe SDK to version 9.3.5. It seems like the Firebase Performance gradle plugin in combination with the case insensitive file system of MacOS is the root cause of this problem.

As @droidluv mentioned here: https://github.com/stripe/stripe-android/issues/1141#issuecomment-507171882 the Firebase Performance plugin does some magic with the class files and overwrites in this case com.stripe.android.stripe3ds2.transaction.a with com.stripe.android.stripe3ds2.transaction.A. A solution to this problem could be to use the ProGuard flag dontusemixedcaseclassnames in the stripe3ds2 library. Building on a non Mac-machine or disabling the Firebase Performance is currently my workaround for this problem.

To reproduce, you could create a new "Basic Activity" project in Android Studio and change the created build.gradle files to these files:

app/build.gradle:

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.firebase.firebase-perf'


android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.stripetest"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.core:core-ktx:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.android.material:material:1.0.0'

    implementation 'com.stripe:stripe-android:9.3.5'

    implementation 'androidx.multidex:multidex:2.0.0'
}

top-level build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.3.40'
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.firebase:firebase-plugins:1.1.5'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

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

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

Syncing and then building the project on a Mac should reproduce this issue.

@j-koenig thanks for the repro steps! Specifying -dontusemixedcaseclassnames seems to not have any impact, and it appears to be in the default proguard config. However, disabling R8 in stripe-3ds2-android did resolve the issue. I'll disable R8 for now in that project to unblock.

This should be fixed in stripe-android 9.3.6, which was just published

@mshafrir-stripe I'm on the R8 team at Google. I think you might have been bitten by https://issuetracker.google.com/issues/129493704

I would love to make sure that we have actually fixed this issue. On the project where you disabled R8, would it be possible for you to enable R8 again and just check if the result contains class files in the same package both with lower-case and upper-case names? If that is the case, that could lead to these issues where unpacking the zip will lose classes and could probably lead to these errors.

If that is the case, can you try using android studio 3.5 RC1 to check that this is no longer the case? In particular, if you still see both the lower-case and upper-case name of some class we would love to know so we can investigate.

Sorry for the inconvenience. Let's work together on getting R8 reenabled for that dependency! :)

@madsager I re-enabled R8 after upgrading to Android Studio 3.5 RC1 and verified using the Gradle config in https://github.com/stripe/stripe-android/issues/1139#issuecomment-508718494 - this seems to have resolved the issue. The change will go out in the next release.

@madsager I just released stripe-android 10.0.1, which has R8 re-enabled

@mshafrir-stripe Great! Thank for confirming that this did indeed resolve the issue!

@madsager @msaffitz-stripe I am on Android Studio 3.5.2, Stripe SDK 12.2.0, firebase-perf 19.0.1, firebase:perf-plugin 1.3.1.

I am still getting this error:

app/build/intermediates/transforms/FirebasePerformancePlugin/integration/debug/149/module-info.class
Illegal class file: Class module-info is missing a super type. Class file version 53.

Can you please help? Thanks!

@bhavinmdesai There was a bug in the Android Gradle Plugin which ended up not filtering out these module classes. This is http://issuetracker.google.com/issues/140290149.

The fix should be in Android Studio 3.6 beta 2. Can you try that out and let me know if that works? If not, I'll open a separate bug so we can work with you to figure out what is going on. Thanks!

@madsager Looks like that module-info.class error has been resolved but now getting the following error:
SHA-256 digest error for org/eclipse/paho/client/mqttv3/internal/websocket/ExtendedByteArrayOutputStream.class

Not sure if it is stripe related!

@bhavinmdesai I do not think that is stripe related. Searching the issue tracker on our end I found this:

http://issuetracker.google.com/issues/115556774

Which is marked as closed. Maybe you can post your setting (version of studio and android gradle plugin used) there so the team can have another look? Thanks for bringing this to our attention.

@bhavinmdesai are you using BouncyCastle?

No I am not.

But not sure if any other dependency is using it. I have a doubt on the AWS
SDK which I am using.

On Wed 6 Nov, 2019, 5:27 PM Michael Shafrir, notifications@github.com
wrote:

@bhavinmdesai https://github.com/bhavinmdesai are you using
BouncyCastle?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/stripe/stripe-android/issues/1139?email_source=notifications&email_token=ABTEDF5A6LU6NBKEQCAM6ADQSKWJ3A5CNFSM4H3E2L22YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDGJFSY#issuecomment-550277835,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ABTEDF6BHTYQYPL2QCHX6MLQSKWJ3ANCNFSM4H3E2L2Q
.

for someone out there who's still experiencing the error, this might help
https://github.com/bcgit/bc-java/issues/390

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dlambeth picture dlambeth  Â·  6Comments

danielgomezrico picture danielgomezrico  Â·  6Comments

danielgomezrico picture danielgomezrico  Â·  9Comments

GuillaumeWrobel picture GuillaumeWrobel  Â·  8Comments

ema987 picture ema987  Â·  5Comments