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 problems #10

Open
Skullper opened this issue Mar 4, 2020 · 2 comments
Open

Proguard problems #10

Skullper opened this issue Mar 4, 2020 · 2 comments

Comments

@Skullper
Copy link

Skullper commented Mar 4, 2020

I'm using proguard and cannot create engine using this code:

ScriptEngineManager().getEngineByName("rhino")

The string above always return null.

I have added these rules into my proguard-rules.pro file:

-keep class org.mozilla.** { *; }
-keep class com.sun.script.** { *; }
-keep class sun.** { *; }
-keep class javax.** { *; }
-keep class apple.** { *; }
-keep class jdk.nashorn.** { *; }
-keepattributes Signature
-dontwarn org.mozilla.javascript.**
-dontwarn org.mozilla.classfile.**
@sunflowerseat
Copy link

Do you know how to fix?
I have added your proguard config,but it still return null.

@Skullper
Copy link
Author

Skullper commented Apr 23, 2020

@sunflowerseat nope. These rules didn't help me too. I decided to use another library:
implementation group: 'org.mozilla', name: 'rhino', version: '1.7.10'
You'll need to change your code slightly.
Mine looks like this:

val mozillaContext = org.mozilla.javascript.Context.enter()
mozillaContext.optimizationLevel = -1
val scope: Scriptable = mozillaContext.initStandardObjects()
val result = mozillaContext.evaluateString(scope, formula, "<cmd>", 1, null).toString()

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

2 participants