LiquidPlayer / LiquidCore

Node.js virtual machine for Android and iOS
MIT License
1.01k stars 128 forks source link

Class not found exception when using LiquidCoreAndroid with proguard #20

Closed martinspaeth closed 7 years ago

martinspaeth commented 7 years ago

Hi there,

When using the LiquidCore lib while proguard is activated will fail.

To solve one just need to add a simple proguard keep rule: -keep class org.liquidplayer.javascript.** { *; }

May this could be part of the Library itself

Sample stacktrace for one running into the same issue: 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] JNI DETECTED ERROR IN APPLICATION: JNI GetMethodID called with pending exception java.lang.ClassNotFoundException: Didn't find class "org.liquidplayer.javascript.JSValue$JNIReturnObject" on path: DexPathList[[zip file "/data/app/packagename.of.the.app-2/base.apk"],nativeLibraryDirectories=[/data/app/packagename.of.the.app-2/lib/x86, /data/app/packagename.of.the.app-2/base.apk!/lib/x86, /system/lib, /vendor/lib]] 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at org.liquidplayer.javascript.JSValue$b org.liquidplayer.javascript.JSObject.setProperty(long, long, java.lang.String, long, int) (JSObject.java:-2) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at void org.liquidplayer.javascript.JSObject$5.run() (JSObject.java:337) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at void org.liquidplayer.javascript.JSContext.a(java.lang.Runnable) (JSContext.java:66) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at void org.liquidplayer.javascript.JSObject.a(java.lang.String, java.lang.Object, int) (JSObject.java:345) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at void org.liquidplayer.javascript.JSObject.a(java.lang.String, java.lang.Object) (JSObject.java:360) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at void packagename.of.the.app.wrapper.a.c.<init>(android.content.Context) (RiveScriptWrapper.java:51) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at void packagename.of.the.app.wrapper.d.<init>(android.content.Context) (Wrapper.java:20) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at java.lang.Integer packagename.of.the.app.wrapper.d.b.d$a.a(java.net.URL[]) (SampleClass.java:384) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at java.lang.Object packagename.of.the.app..b.d$a.doInBackground(java.lang.Object[]) (AFragment.java:375) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at java.lang.Object android.os.AsyncTask$2.call() (AsyncTask.java:305) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at void java.util.concurrent.FutureTask.run() (FutureTask.java:237) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at void android.os.AsyncTask$SerialExecutor$1.run() (AsyncTask.java:243) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at void java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker) (ThreadPoolExecutor.java:1133) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at void java.util.concurrent.ThreadPoolExecutor$Worker.run() (ThreadPoolExecutor.java:607) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at void java.lang.Thread.run() (Thread.java:761) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427]

ericwlange commented 7 years ago

Thanks for reporting. I will add a proguard rules file to the library.

ericwlange commented 7 years ago

Should be fixed in 70e9a7f0556886463ffe2d35ec4d6afb60149c02

ericwlange commented 7 years ago

This is fixed in Release 0.2.2