Java Question Proguard for Eclipse libs for b4a

Discussion in 'Libraries developers questions' started by kepler, Jun 9, 2015.

  1. kepler

    kepler Active Member Licensed User

    Hi,

    I'm not sure if this is the right place to ask this question. But maybe someone can help.

    I've got several libs in Java made in Eclipse Kepler with the interface for usage in B4A.
    I'm currently trying to shrink and protect their code with Proguard - using the GUI tool (I can't seem to be able to introduce it in Eclipse directly). I've read the manuals.

    But, when using Proguard I get immediatly problems with the b4a shared library and with javax.swing...

    Does anyone has a clue how to configure the proguard.pro file in order that this doesn't happen?

    Kind regards,

    Kepler
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Where does swing come from? This is not an Android API.

    You need to make sure that all the public method names are kept.
     
  3. kepler

    kepler Active Member Licensed User

    Hi Erel,

    Yes, I do realize that. The fact is that the libs run perfectly in B4A - no problem there. But when I try the obfuscation in the Proguard GUI I get an automated error regardind B4AShared (not Core). I just added that it appeared also something related to swing...but I think that if I can solve the problem with the shared b4a, I can solve the "swing" problem...whatever that is.

    And of course I must maintain the main procedures available for b4a understands them.

    Kind regards,

    Kepler
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    I did use proguard in the past. I don't remember the exact steps now. Maybe you are trying to obfuscate B4AShared.jar by mistake?
     
  5. kepler

    kepler Active Member Licensed User

    Hi,

    You might be right.
    IF I disable the shrink option - at least the general one - and add this lines:

    -libraryjars 'C:\Program Files\Android\android-sdk\platforms\android-8\android.jar'
    -libraryjars 'C:\Program Files\Anywhere Software\Basic4android\Libraries\B4AShared.jar'

    -keep public class com.google.vending.licensing.ILicensingService
    -keep public class com.android.vending.licensing.ILicensingService
    -keep public class anywheresoftware.b4a.*
    -keep class javax.** {
    <fields>;
    <methods>;
    }

    I get, at least, an obfuscated code. Reversing it, gives a good clean code, but with all the variables replaced/scrambled.

    I might be in the right way...

    I'll test the jar, and let you know. Thanks Erel :)

    Kind regards,

    Kepler
     
    sadeq_hitex likes this.
  6. Informatix

    Informatix Expert Licensed User

    Here's an example for Proguard v5, with code optimization and obfuscation enabled.
     

    Attached Files:

Loading...