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 documentation #29

Closed
eveliotc opened this issue May 5, 2015 · 11 comments
Closed

Proguard documentation #29

eveliotc opened this issue May 5, 2015 · 11 comments

Comments

@eveliotc
Copy link

eveliotc commented May 5, 2015

Hey folks,

This SDK gets broken on proguarded builds, We couldn't find any documentation on this matter nor here nor on the website so we ended up including following lines in our configuration, it would be nice to have official docs on it.

# Braintree/PayPal
-dontwarn com.braintreepayments.**
-keep class com.braintreepayments.** { *; }
-keep interface com.braintreepayments.** { *; }
-dontwarn com.paypal.**
-keep class com.paypal.** { *; }
-keep interface com.paypal.** { *; }
@lkorth
Copy link
Member

lkorth commented May 12, 2015

Thanks for sharing what worked for you. We'll test it out and work on adding it to the documentation.

For reference, the PayPal proguard config is available in the PayPal Android SDK repo.

@lkorth
Copy link
Member

lkorth commented May 23, 2015

@eveliotc, thanks for the report. This was fixed in 1.5.1. ProGuard will no longer break the SDK and we've also documented the rules that should be added for ProGuard builds to prevent warnings.

@lkorth lkorth closed this as completed May 23, 2015
@plastiv
Copy link

plastiv commented Dec 8, 2015

With compile "com.braintreepayments.api:braintree:2.1.0" depending on

compile 'com.google.android.gms:play-services-wallet:8.3.0'
compile 'com.braintreepayments.api:data-collector:2.1.0'

Is it safe to just ignore missing code with

-dontwarn com.google.android.gms.**
-dontwarn com.devicecollector.**

Or you are expecting us to bundle wallet and devicecollector dependency when using braintree?

@lkorth
Copy link
Member

lkorth commented Dec 8, 2015

The proguard rules we have currently documented only include -dontwarn com.google.android.gms.**. Are you receiving warnings for com.devicecollector.* as well?

@plastiv
Copy link

plastiv commented Dec 9, 2015

From this guide: https://developers.braintreepayments.com/guides/client-sdk/android/v2#gradle
I get an impression that it is only needed to add next dependency:

compile 'com.braintreepayments.api:braintree:2.+'

With enabled proguard assembleRelease triggers next warnings:

Initializing...
Warning: com.braintreepayments.api.DataCollector$1$1: can't find superclass or interface com.devicecollector.DeviceCollector$StatusListener
Warning: com.braintreepayments.api.DataCollector$1: can't find referenced class com.devicecollector.DeviceCollector
Warning: com.braintreepayments.api.DataCollector$1: can't find referenced class com.devicecollector.DeviceCollector
Warning: com.braintreepayments.api.DataCollector$1: can't find referenced class com.devicecollector.DeviceCollector
Warning: com.braintreepayments.api.DataCollector$1: can't find referenced class com.devicecollector.DeviceCollector
Warning: com.braintreepayments.api.DataCollector$1: can't find referenced class com.devicecollector.DeviceCollector
Warning: com.braintreepayments.api.DataCollector$1: can't find referenced class com.devicecollector.DeviceCollector
Warning: com.braintreepayments.api.DataCollector$1: can't find referenced class com.devicecollector.DeviceCollector$StatusListener
Warning: com.braintreepayments.api.DataCollector$1: can't find referenced class com.devicecollector.DeviceCollector
Warning: com.braintreepayments.api.DataCollector$1$1: can't find referenced class com.devicecollector.DeviceCollector$StatusListener
Warning: com.braintreepayments.api.DataCollector$1$1: can't find referenced class com.devicecollector.DeviceCollector$ErrorCode
Warning: com.braintreepayments.api.DataCollector$1$1: can't find referenced class com.devicecollector.DeviceCollector
Warning: com.braintreepayments.api.DataCollector$1$1: can't find referenced class com.devicecollector.DeviceCollector$ErrorCode
Warning: com.braintreepayments.api.DataCollector$1$1: can't find referenced class com.devicecollector.DeviceCollector$ErrorCode
Warning: there were 14 unresolved references to classes or interfaces.
         You may need to add missing library jars or update their versions.
         If your code works fine without the missing classes, you can suppress
         the warnings with '-dontwarn' options.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Warning: Exception while processing task java.io.IOException: Please correct the above warnings first.

This is not triggred by the sample project here at the braintree source code, because it also includes Drop-In dependency which have compile 'com.braintreepayments.api:data-collector:2.1.0' dependency:
https://github.com/braintree/braintree_android/blob/master/Demo/build.gradle#L60

Question is: is it safe to ignore com.devicecollector.* references when compiling project only with com.braintreepayments.api:braintree:2.1.0?

@lkorth
Copy link
Member

lkorth commented Dec 9, 2015

Yes, just add -dontwarn com.devicecollector.** to your Proguard Config. I'll update the documentation.

@makk909
Copy link

makk909 commented Oct 21, 2016

I am still getting the same error as posted above while using proguard. The only dependency, I have included is this onecompile 'com.braintreepayments.api:drop-in:3.0.0' . I even tried ignoring warnings by adding this line -dontwarn com.devicecollector.** in the proguard but nothing helped. I didn't find any documentation for 3.0.0 as well and it's specifically mentioned that we don't need any proguard rules but then why this error?

@lkorth
Copy link
Member

lkorth commented Oct 21, 2016

@makk909 Please see #123 and #124, a release has not been made yet, the change to the proguard file is only on master.

@makk909
Copy link

makk909 commented Oct 21, 2016

That's fine but when I am manually ingoring this in my project proguard file even then it doesn't work. Shall I use this -dontwarn com.braintreepayments.api.DataCollector.** for ignoring all warnings when proguard is enabled? Hoping it's not going to cause any issue with the library. Right?

@lkorth
Copy link
Member

lkorth commented Oct 24, 2016

The directive you're looking for is actually -dontwarn com.kount.**

@makk909
Copy link

makk909 commented Oct 25, 2016

Oh thanks. it looks it works :)

On Mon, Oct 24, 2016 at 7:57 PM, Luke Korth notifications@github.com
wrote:

The directive you're looking for is actually -dontwarn com.kount.**
https://github.com/braintree/braintree_android/blob/e8c0e15003c907b7f455f8e72b2fc6f0aa36e914/Braintree/proguard.pro


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#29 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGtAWPU_H9EnxHtaHPuLxUw0NGDD0TAyks5q3MBQgaJpZM4EP0zJ
.

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