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

ProGuard Rules Issues #445

Closed
giovanniandreuzza opened this issue Mar 28, 2024 · 6 comments
Closed

ProGuard Rules Issues #445

giovanniandreuzza opened this issue Mar 28, 2024 · 6 comments

Comments

@giovanniandreuzza
Copy link

giovanniandreuzza commented Mar 28, 2024

Summary

App not working when applying shrinking, obfuscation and minify.

Code to reproduce

Building the apk with:

  • isDebuggable = false
  • isMinifyEnabled = true
  • isShrinkResources = true

and by adding in gradle.properties:
android.enableR8.fullMode=true

Android version

Android 7.1 and Android 13

Impacted devices (Android devices or readers)

All

SDK version

2.23.3

Other information

Error Log:

FATAL EXCEPTION: pool-16-thread-1
                                                                                                    Process: xxx, PID: 5993
                                                                                                    java.lang.ExceptionInInitializerError
                                                                                                    	at com.stripe.stripeterminal.internal.common.api.ApiClient.discoverLocations(SourceFile)
                                                                                                    	at com.stripe.stripeterminal.internal.common.resourcerepository.OnlineDirectResourceRepository.getReaderLocations(SourceFile:14)
                                                                                                    	at com.stripe.stripeterminal.internal.common.resourcerepository.DirectResourceRepositoryRouter.getReaderLocations(SourceFile)
                                                                                                    	at com.stripe.stripeterminal.internal.common.resourcerepository.ProxyResourceRepository$getReaderLocations$1.invoke(SourceFile:2)
                                                                                                    	at com.stripe.stripeterminal.internal.common.resourcerepository.ProxyResourceRepository$getReaderLocations$1.invoke(SourceFile:1)
                                                                                                    	at com.stripe.stripeterminal.internal.common.resourcerepository.ProxyResourceRepository.withCurrentRepository(SourceFile:5)
                                                                                                    	at com.stripe.stripeterminal.internal.common.resourcerepository.ProxyResourceRepository.getReaderLocations(SourceFile)
                                                                                                    	at com.stripe.stripeterminal.internal.common.adapter.BbposAdapterLegacy.getLocationsForDiscovery(SourceFile)
                                                                                                    	at com.stripe.stripeterminal.internal.common.adapter.BbposUsbAdapterLegacy$DiscoverUsbReadersOperation$onUpdateDiscoveredReaders$1.invokeSuspend(SourceFile:193)
                                                                                                    	at p5.a.resumeWith(SourceFile:9)
                                                                                                    	at K5.x.y(SourceFile:7)
                                                                                                    	at F5.a.resumeWith(SourceFile:23)
                                                                                                    	at p5.a.resumeWith(SourceFile:32)
                                                                                                    	at F5.F0.y(SourceFile:54)
                                                                                                    	at F5.a.resumeWith(SourceFile:23)
                                                                                                    	at p5.a.resumeWith(SourceFile:32)
                                                                                                    	at F5.J.run(SourceFile:95)
                                                                                                    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
                                                                                                    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
                                                                                                    	at java.lang.Thread.run(Thread.java:761)
                                                                                                    	Suppressed: K5.h: [w0{Cancelling}@fd820ae, java.util.concurrent.Executors$FinalizableDelegatedExecutorService@d8f1e4f]
                                                                                                    Caused by: java.lang.IllegalArgumentException: Unexpected signature for public final com.stripe.stripeterminal.external.models.SetupAttemptUnion com.stripe.stripeterminal.external.models.SetupAttemptUnionJsonAdapter.fromJson(W3.y,W3.t).
                                                                                                    @FromJson method signatures may have one of the following structures:
                                                                                                        <any access modifier> R fromJson(JsonReader jsonReader) throws <any>;
                                                                                                        <any access modifier> R fromJson(JsonReader jsonReader, JsonAdapter<any> delegate, <any more delegates>) throws <any>;
                                                                                                        <any access modifier> R fromJson(T value) throws <any>;
                                                                                                    
                                                                                                    	at n1.b.b(SourceFile:536)
                                                                                                    	at com.stripe.stripeterminal.internal.common.proto.ProtoConverter.<clinit>(SourceFile:36)
                                                                                                    	... 20 more
@giovanniandreuzza giovanniandreuzza changed the title Progouard Rules Issues ProGuard Rules Issues Mar 28, 2024
@chr-stripe
Copy link
Collaborator

Hi @giovanniandreuzza, I believe you might be running into Moshi Issue #1663. We addressed this issue (as reported in #386) in version 3.2.1 of our own SDK by adding this line to our consumer Proguard rules:

-keep,allowobfuscation,allowshrinking class com.squareup.moshi.JsonAdapter

However, I see that you are seeing this on Android 7.1, so you may not be able to use SDK 3.X since it only supports Android 8 and up. If not, you should be able to include this same rule directly in your own application's Proguard configuration to resolve your issue. Please let me know if that works for you.

Hopefully this rule will be integrated directly into Moshi some day in the future.

@giovanniandreuzza
Copy link
Author

Hi @chr-stripe, thanks for the help. I already tested and it works perfectly 🥳
Yes I have to support hundreds of devices we have in the field that are running Android 7.1 and use stripe pos terminal.

Thanks again and have a nice day!

@federicopolesello
Copy link

federicopolesello commented Mar 29, 2024

Hi @chr-stripe, one question a bit off topic. I saw @giovanniandreuzza is still using the SDK version 2.X in Android 7.1 and I'm in the same situation.
As that version 2.X will not be supported from next 1st October, I guess your team probably will interrupt the services sometime after that date.
Will it be possible to be informed well in advance when you decide on the exact date when the services under 2.X will be permanently stopped?
Thank you very much

@federicopolesello
Copy link

@chr-stripe can you help me regarding my message above?

@xiaoshen-stripe
Copy link
Contributor

Hi @chr-stripe, one question a bit off topic. I saw @giovanniandreuzza is still using the SDK version 2.X in Android 7.1 and I'm in the same situation. As that version 2.X will not be supported from next 1st October, I guess your team probably will interrupt the services sometime after that date. Will it be possible to be informed well in advance when you decide on the exact date when the services under 2.X will be permanently stopped? Thank you very much

Hey nice to meet you @federicopolesello
As you mentioned, our SDK V2.x will be moving to end-of-life status in October 2024. after that it will no longer receive any critical updates/patches necessary to ensure the Terminal's functionality.

However we currently have no plan to explicitly block the use of V2.x SDK beyond the EOL date. Should we decide to do so, we will make sure to communicate the exact cutoff date well in advance to all impacted users including yourself.

I hope this helps, thanks.
cc: @chr-stripe

@federicopolesello
Copy link

@xiaoshen-stripe Awesome! Thank you very much for your answer. 🙏

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

4 participants