PaycomUZ / AndroidSDK

Paycom Android SDK
Apache License 2.0
27 stars 15 forks source link

Proguard fix #5

Closed azizkayumov closed 2 years ago

azizkayumov commented 4 years ago

Default ProGuard will obfuscate and alter the name of your library classes, making it impossible for Android projects to reference them. Here are steps to reproduce the issue:

  1. Created a dummy android project
  2. Added implementation 'uz.paycom:payment:1.0.5.5' to build.gradle
  3. Refreshed and AS downloaded Payme Android SDK.
  4. Tried to follow the README
  5. Could not reference EXTRA_ID, EXTRA_AMOUNT from PaymentActivity.java.

Can I assume that the default Proguard settings with minifyEnabled=True is causing the issue?
I previewed the library on AS from libs folder, I can see that Payment Android SDK is full of java classes with "a"s and "b"s.

Screen Shot 2019-12-17 at 3 27 45 PM

In this PR I added some basic "consumer" rules for payment lib. Let me know your thoughts on this. A typical library's Proguard rules: https://stuff.mit.edu/afs/sipb/project/android/sdk/android-sdk-linux/tools/proguard/docs/index.html#manual/examples.html

MatnazaroFF commented 4 years ago

Another option for proguard-payment.pro Screenshot from 2019-12-17 12-47-01 Screenshot from 2019-12-17 12-47-17 Screenshot from 2019-12-17 12-47-41

azizkayumov commented 4 years ago

I got your point, what about the latest commit? The docs on README.md says one can use the following classes: PaymentActivity.java constants, PaycomSandBox.java and Result.java. I tried to make it as defensive as possible:

-keep class uz.paycom.payment.PaymentActivity {
    public static <fields>;
}

-keep class uz.paycom.payment.utils.PaycomSandBox { *; }
-keep class uz.paycom.payment.model.Result { *; }
MatnazaroFF commented 4 years ago

@AbduazizKayumov Perfectly. You understood me correctly.

YadgarovIslombek commented 3 years ago

?

YadgarovIslombek commented 3 years ago

Standart ProGuard sizning kutubxona sinflaringiz nomini buzadi va o'zgartiradi, shuning uchun Android loyihalarida ularga murojaat qilish imkonsiz bo'ladi. Muammoni takrorlash uchun quyidagi qadamlar:

  1. A yaratilgan model android loyihani
  2. Yükladi implementation 'uz.paycom:payment:1.0.5.5'uchunbuild.gradle
  3. Yangilangan va AS yuklab olingan Payme Android SDK.
  4. README- ni kuzatishga harakat qildim
  5. EXTRA_ID, EXTRA_AMOUNT, PaymentActivity.java-dan ma'lumot olinmadi .

Men deb taxmin qilish mumkin Odatiy Proguard parametrlarini bilan minifyEnabled=Truemuammoni hal nima bo'ladi? Libs papkasida AS-dagi kutubxonani oldindan ko'rib chiqdim, Payment Android SDK-ning java sinflariga to'la "a" va "b" lar bilan to'ldirilganligini ko'rdim.

2019 yil 17-iyun, soat 3 27 45 da ekran tasviri

Ushbu PR-da lib uchun ba'zi bir "iste'molchilar" qoidalarini qo'shdim. Bu boradagi fikrlaringizni menga xabar bering. Odatda kutubxonaning Proguard qoidalari: https://stuff.mit.edu/afs/sipb/project/android/sdk/android-sdk-linux/tools/proguard/docs/index.html#manual/examples.html

????????????????

Elbek-hub commented 2 years ago

implementation 'uz.paycom:payment:1.0.5.5'

Shuni aniqlamayapti ?