Git Product home page Git Product logo

Comments (13)

AndroidDeveloperLB avatar AndroidDeveloperLB commented on June 1, 2024

I tried this:

#for https://github.com/terl/lazysodium-android#1-install
-keepclassmembers class * extends com.sun.jna.** {
    <fields>;
    <methods>;
}

Got from here:
https://stackoverflow.com/a/10588578/878126

I even tried:

-keep public class com.sun.jna.** {
  public protected *;
}

And then I got a bit different error:

    java.lang.UnsatisfiedLinkError: Can't obtain static method dispose from class com.sun.jna.Native
        at com.sun.jna.Native.initIDs(Native Method)
        at com.sun.jna.Native.<clinit>(Native.java:24)
        at com.sun.jna.Native.register(Native.java:3)
        at com.goterl.lazycode.lazysodium.c.<init>(SodiumAndroid.java:4)
        at com.goterl.lazycode.lazysodium.c.<init>(SodiumAndroid.java:1)

Please update the repository with the file and with documentation about this.

from lazysodium-android.

AndroidDeveloperLB avatar AndroidDeveloperLB commented on June 1, 2024

I think I got it this way:

-keep class com.sun.jna.** { *; }
-keep class * implements com.sun.jna.** { *; }

Please let me know if that seems right, and that maybe I forgot anything.

from lazysodium-android.

gurpreet- avatar gurpreet- commented on June 1, 2024

Hello @AndroidDeveloperLB, thank you for the question. Yes there are some proguard rules to apply as you have found out. The ones you commonly need to put down are the ones from the JNA library.

I am glad you have found the solution. I should really write this down in the documentation πŸ™‚

from lazysodium-android.

gurpreet- avatar gurpreet- commented on June 1, 2024

I've added this to the installation pages.

from lazysodium-android.

AndroidDeveloperLB avatar AndroidDeveloperLB commented on June 1, 2024

@gurpreet- I can't access the link
Are those rules that I've made seem ok? Are they correct?
Please update the repository itself, with Proguard rules so that whoever uses it won't even need to bother changing his own rules.

Also, I don't understand about the license here, and whether using Proguard affects it:
#33

This repository has one license, but the other that it uses somehow 2 other licenses, and that I can choose. It is very confusing...

from lazysodium-android.

gurpreet- avatar gurpreet- commented on June 1, 2024

Yes I saw your other question posted, no need to mention it in this thread πŸ™‚

Sorry I posted the wrong link above, I've updated it. You should add this to your proguard rules basically:

-dontwarn java.awt.*
-keep class com.sun.jna.* { *; }
-keepclassmembers class * extends com.sun.jna.* { public *; }

Proguard is essentially a way of saying when obfuscating the app, please don't do anything to the following classes.

from lazysodium-android.

AndroidDeveloperLB avatar AndroidDeveloperLB commented on June 1, 2024

I asked there about it, and some people say that using Proguard might affect the license:

https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/jna-users/FPyExuBlb7o/EbANy0bvAgAJ

That's why I'm worried...

from lazysodium-android.

gurpreet- avatar gurpreet- commented on June 1, 2024

I believe you have very little to worry about πŸ™‚ JNA is under APL2.0 as far as we're concerned.

Remember this is just saying please do not obfuscate (i.e modify) JNA classes (which is APL2.0 as far as we're concerned) using proguard:

-keep class com.sun.jna.* { *; }
-keepclassmembers class * extends com.sun.jna.* { public *; }

from lazysodium-android.

AndroidDeveloperLB avatar AndroidDeveloperLB commented on June 1, 2024

"Remember this is just saying please do not obfuscate (i.e modify) JNA classes (which is APL2.0 as far as we're concerned) using proguard:"

You say that according to the license I'm not allowed, or because of the crashes?
I excluded it from being obfuscated because of the crashes. Didn't know it could violate the terms. Are you sure it can?

I tried the rules you've provided. Seems to work fine. Please consider adding these into your repository, so that whoever uses it won't have to set it.

from lazysodium-android.

gurpreet- avatar gurpreet- commented on June 1, 2024

No there are no violations in terms if you add those proguard rules. Because you brought up licenses in this thread, I was saying even if you add those rules there would be no violations as everything is licensed APL2. Yes add those rules to also fix the problem.

from lazysodium-android.

AndroidDeveloperLB avatar AndroidDeveloperLB commented on June 1, 2024

I meant that if we ignore that it crashes, if I don't put the rules, would that be an issue because it obfuscates the code?

I think the answer is that it doesn't matter at all.

from lazysodium-android.

gurpreet- avatar gurpreet- commented on June 1, 2024

In terms of licenses, it doesn't matter if you do or don't obfuscate. I just read that even the GPL doesn't regard obfuscated code as real source code so you are free to obfuscate. Plus I'm pretty sure, but not certain, that the APL2 allows obfuscation.

In order for freedoms 1 and 3 (the freedom to make changes and the freedom to publish the changed versions) to be meaningful, you need to have access to the source code of the program. Therefore, accessibility of source code is a necessary condition for free software. Obfuscated β€œsource code” is not real source code and does not count as source code.

https://www.gnu.org/philosophy/free-sw.html

In terms of fixing the crash, you have to put those rules in to keep those JNA classes to stop them from being obfuscated. To be clear, let me reiterate, because you're getting confused, those rules stop JNA classes from being obfuscated. So therefore if you are not obfuscating them, then you are not modifying them, so there is no cause for concerns in terms of licensing as you are not doing anything to JNA.

However your concerns about obfuscation are unfounded because, as mentioned in the first paragraph of this comment, obfuscated code does not count as "real" code in terms of the APL/GPL/LGPL, so you can obfuscate freely.

from lazysodium-android.

AndroidDeveloperLB avatar AndroidDeveloperLB commented on June 1, 2024

Sure. Thank you very much for your time.
Please do update the repository though.

from lazysodium-android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.