小编rah*_*ini的帖子

在集成proguard之后,在Rhino API中出现问题

在集成Proguard之后,我面临着Rhino API的问题.

没有proguard,下面的代码工作正常.

org.mozilla.javascript.Context context = org.mozilla.javascript.Context.enter();
context.setOptimizationLevel(-1);
ScriptableObject scope = context.initStandardObjects();
try {
    InputStream inputStream = mContext.getAssets().open(JAVASCRIPT_FILE);
    InputStreamReader reader = new InputStreamReader(inputStream);

    context.evaluateReader(scope, reader, JAVASCRIPT_FILE, 1, null);
} catch (IOException exception) {
    throw new CustomException(null, exception);
}
Function functionAdd = (Function) scope.get(JAVASCRIPT_FUNCTION_NAME);

Object returnObject = functionAdd.call(context, scope, scope, new Object[] {
    parameter1, parameter2, parameter3
});
Run Code Online (Sandbox Code Playgroud)

但在整合Proguard后,我得到以下错误:

02-26 14:58:13.200: E/AndroidRuntime(11607): Caused by: java.lang.IllegalStateException: Failed to create VMBridge instance
02-26 14:58:13.200: E/AndroidRuntime(11607): at org.a.b.ds.<clinit>(Unknown Source)
02-26 14:58:13.200: E/AndroidRuntime(11607): ... 11 more
Run Code Online (Sandbox Code Playgroud)

android rhino

1
推荐指数
1
解决办法
599
查看次数

标签 统计

android ×1

rhino ×1