-
Notifications
You must be signed in to change notification settings - Fork 870
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 problem about rhino in Android #540
Comments
I don't have proguard or know much about it. I do know that "rhino" was a supported script engine in old versions of Java, but it hasn't been for a while. So it's likely that "getEngineByName" is correctly returning null. |
I am getting same issue after proguard. Getting null pointer exception while evaluating engine val engine = ScriptEngineManager().getEngineByName("javascript") |
I don't think this issue is related to anything in this repository. https://github.com/APISENSE/rhino-android This mentions at the bottom of the README that Proguard will cause issues with ScriptEngine. |
I think this issue can be closed as it is basically half of the issues opened against the APISENSE/rhino-andriod repository. APISENSE/rhino-android#1 The workaround in issue 10 is to use Rhino directly instead of the apisense ScriptEngine with Proguard. |
And APISENSE/rhino-android#8 (comment) indicates it was resolved by an Andriod SDK update. |
Assuming resolved as per comments by @tonygermano |
compile 'io.apisense:rhino-android:1.0'
TextView resultTextView = findViewById(R.id.result_text_view);
String currentText = resultTextView.getText().toString();
boolean valid = checkForValidity();
double result=0;
if(valid){
ScriptEngine engine = new ScriptEngineManager().getEngineByName("rhino");
try{
result = (double)engine.eval(currentText);
}catch(Exception e){
Toast.makeText(this,"Exception Raised",Toast.LENGTH_SHORT).show();
}
currentText = currentText +"\n"+ "="+(result);
}
resultTextView.setText(currentText);
NullPointerException after proguard
Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.Object javax.script.ScriptEngine.eval(java.lang.String)' on a null object reference
i tried these.But failed.
-keep class org.mozilla.** { ; }
-keep class javax.script.* { *; }
The text was updated successfully, but these errors were encountered: