-
Notifications
You must be signed in to change notification settings - Fork 41
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
Duplicate class com.squareup.Pan found in modules jetified-card-42 (com.squareup.android:card:42) and jetified-reader-sdk-internals-1.5.1 (com.squareup.sdk.reader:reader-sdk-internals:1.5.1) #30
Comments
We are also facing the same issue, while trying to integrate GiftCard payments and Square Reader. GiftCardPayment SDK : Square Reader SDK : Error: |
Same here. We support Square in-app purchases and card readers. So there are two Square libraries in our project: We can get through the build phase by excluding module for one of them:
But it will crash when taking payment with Square in-app purchase. |
We are also facing the same issue, Please fix it soon. Due to this we are unable to use both dependencies in one project. Duplicate class com.squareup.Pan found in modules jetified-card-42 (com.squareup.android:card:42) and jetified-reader-sdk-internals-1.5.6 (com.squareup.sdk.reader:reader-sdk-internals:1.5.6) |
So I found a solution to resolving the build error. To avoid misleading other devs, and preventing thumbs down, again, this is for resolving the build error. I added the code below to my app/build.gradle and it built successfully with both In-App-Payments SDK and Reader SDK. I understand excluding an entire module will provide issues down the line. I'm currently building this on the Expo remote server to test the apk on a physical device. Note: The difficulty was trying to exclude the module from "reader-sdk-internals." My ultimate goal was to directly reference the namespace in either of those 2 dependencies. Hopefully, Square will have a resolution.
|
23 hours later, I found a solution and verified that it works on Android!! Well, from the In-App-Payments SDK perspective! Reason I say that is because I haven't started development for the Square Reader SDK yet, and will within the next 2 weeks. Solution (TLDR): Add the Square-Reader-Sdk repository directly into your repo, and modified the "reader-sdk-internals-x.x.x.jar" to not include the "Pan.class" file. Overview: Since we're downloading the Square repo local, and build-time, I thought, "why not maintain this repo until Square figures it out?" At this moment, 1.7.1 is the latest version. I logged into "https://sdk.squareup.com/android" with the repo credentials used in the build.gradle, and made a folder called "square" (can be any name) in my "android" folder. There I added the directories that exist in the Square repo we just logged into. "com/squareup/sdk/reader." In the "reader" directory, you should see 3 other directories that house .aar, .pom, and .jar files. Create those directories, and download those files and place them in their respective directories. Next, I located the "reader-sdk-internals-x.x.x.jar" in the "reader-sdk-internals/x.x.x" subdirectory of "com/squareup/sdk/reader." I opened the .jar in the 7zip file manager and deleted "Pan.class". Now that the class is removed, we need to stop pointing to Square's repo, and point to our new location. I commented the maven reference to that the repo, added "maven { url(new File("$rootDir/app/square")) }" and under dependences, I added "implementation fileTree(dir: "$rootDir/app/square", include: ['.aar', '.pom'], exclude: [])" I also added "maven { url(new File("$rootDir/app/square")) }" to the project build.gradle (not sure if it's necessary, but it was just for safety measures). With these changes, I was able to successfully build the app, and use the card entry screen. I'm not sure what else is, or isn't working, as I'm still in the early stages of development, but my app isn't broken (as of now) for the In-App-Payment sdk. This solution isn't the most scalable. Whenever there's a new version, I'll have to bring down the latest version and remove the Pan.class from the reader-sk-internals-x.x.x.jar and update my "android/square" location in my repo. Hopefully, Square sees this post and makes it so that both SDKs can exist in the same app at the same time. See pics for reference! |
@lrob7325 Thanks for sharing your solution. We remove the in-app payment SDK and use the card reader SDK with manual card input entry to handle paying with inputting card number situation. |
Just coming back to say that as of 6/23/2024, this solution worked. I needed to go from 1.7.1 to 1.7.5 for SDK 34. I'm still able to have both the Square Reader and In-App SDKs in the app. |
Getting "Duplicate class com.squareup.Pan found in modules jetified-card-42 (com.squareup.android:card:42) and jetified-reader-sdk-internals-1.5.1 (com.squareup.sdk.reader:reader-sdk-internals:1.5.1)" when using both in app payment and reader sdk in same project.
def inAppPaymentsSdkVersion = '1.5.2'
implementation "com.squareup.sdk.in-app-payments:card-entry:$inAppPaymentsSdkVersion"
implementation "com.squareup.sdk.in-app-payments:google-pay:$inAppPaymentsSdkVersion"
def readerSdkVersion = "1.5.1"
implementation "com.squareup.sdk.reader:reader-sdk-$SQUARE_READER_SDK_APPLICATION_ID:$readerSdkVersion"
runtimeOnly "com.squareup.sdk.reader:reader-sdk-internals:$readerSdkVersion"
The text was updated successfully, but these errors were encountered: