Open mhoseini967 opened 4 years ago
Is it also not working on debug? The exception message is telling that property is missing, but it's there if you look into the source code. It looks like obfuscation could be doing too much on release build (though log doesn't seem to be obfuscated), make sure you did setup proguard file as explained in the readme ProGuard for Android
.
Although it could have been done better in the library itself by adding @SerializedName to each model field. Nowadays it's up to libraries to provide proper proguard files.
edit: Groovy is required for Android projects.
The library itself certainly would need an update, I am also against using Groovy in Java (and especially Android) libraries, it throws too much dependencies for non-Groovy projects. I do have separate branch for Java version, it's actually older than Groovy version branch, but unfortunately less finished.
I've reproduced Your problem. It has nothing to do with proguard, You are indeed missing Groovy dependencies, app gradle file should include this line in dependencies:
implementation 'org.codehaus.groovy:groovy:2.4.12:grooid'
I'll update the readme, thanks for the report.
E/AndroidRuntime: FATAL EXCEPTION: main Process: ir.mohamad.wordpressblog, PID: 24817 groovy.lang.MissingPropertyException: No such property: context for class: gq.coderetort.wpclient.rest.queries.Query at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:53) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.setGroovyObjectProperty(ScriptBytecodeAdapter.java:534) at gq.coderetort.wpclient.rest.queries.Query$QueryBuilder.build(Unknown Source:29) at ir.mohamad.wordpressblog.MainActivity$1.run(MainActivity.java:38) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6669) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)