I'm running the following code in my Runnable Class and getting an error. Both the code and the error are detailed below.
Code :
public class RunnableJob implements Runnable {
public Products products = new Products();
@Override
public void run() {
products
.productsField( "search", "iphone" );
/* Make the Request */
try {
JSONObject results = products.getProducts();
Log.i("System.out", results.getString("code"));
} catch (Exception e) {
e.printStackTrace();
Log.i("error", "hit the exception");
}
}
}
This is the error we're getting:
07-17 12:16:51.766 11535-11550/com.example.jesarshah.snapcart E/AndroidRuntime﹕ FATAL EXCEPTION: Thread-197
Process: com.example.jesarshah.snapcart, PID: 11535
java.lang.NoSuchMethodError: No direct method <init>(Ljava/io/InputStream;)V in class Lorg/json/JSONTokener; or its super classes (declaration of 'org.json.JSONTokener' appears in /system/framework/core-libart.jar)
at com.semantics3.api.Semantics3Request.fetch(Semantics3Request.java:92)
at com.semantics3.api.Semantics3Request.runQuery(Semantics3Request.java:220)
at com.semantics3.api.Semantics3Request.get(Semantics3Request.java:263)
at com.semantics3.api.Semantics3Request.get(Semantics3Request.java:255)
at com.semantics3.api.Products.getProducts(Products.java:21)
at com.example.jesarshah.snapcart.RunnableJob.run(RunnableJob.java:30)
at java.lang.Thread.run(Thread.java:818)