Adding library to Business Logic project

I am trying to use a 3rd-Party library with my Business Logic code; it is this one here: okhttp

Normally with an Android Studio project I just add it to the gradle. But I’m unsure how to integrate it here with the project / code generated by Backendless.

Thank you

See step 2 under “Customizing and Running Code”

I’ve added the JAR to my libs folder, however when I try to deploy my code I get an error:</img>

This error means that either the specified class or one of its dependencies is missing.

I added the JAR for the library to the libs folder as suggested. It appears to all be there:</img>
Is there something extra I need to be doing for this to work when deploying to the server as I am attempting to do?


I am thinking maybe I did not add the library correctly, because when I ran the code locally I got a similar error:</img>

Here’s the code I am trying to deploy:

public void execute( String appVersionId ) throws Exception
  String apiKey = "6e46fb2e1acef97d5bb8b75d4e5c9e5a";
  String forecastUrl = "" + apiKey + "/" + "41.9484" + "," + "-87.6553";

  OkHttpClient client = new OkHttpClient();

  Request request = new Request.Builder()
  Call call = client.newCall(request);

  call.enqueue(new Callback() {
    public void onFailure(Call call, IOException e) {


    public void onResponse(Call call, Response response) throws IOException {


I am able to deploy it when I comment out any references to the Callback class. Which I find odd because why can I deploy when referencing other classes from the same library?

Ah, I am guessing this could be related to trying to run asynchronous code on the server side.

Unfortunately I got this error back when I tried running synchronously:

Caused by: java.lang.NoClassDefFoundError: okhttp3/OkHttpClient

So still wondering if I am importing the library incorrectly.

    Check the "location.jar" property in in bin/ It must point to your libs folder. Make sure that all other JAR dependent files that the jar you put in there are also available in the libs folder.
  1. Yes, it properly points to my libs folder

  2. I believe they are all available in the libs folder, as this is the only JAR I added:</img>


Here’s a more detailed look at the error I get back from the server when the code runs / is locally debugged through code runner:</img>

A dependency is missing. Do you research and find out what other JARs okhttp depends on.

I noticed it says my JAVA_HOME and JRE_HOME are not set:</img>

Wondering if this could be related and how to fix it, thanks


It has nothing to do with the problem you’re experiencing. There is a missing dependency…

I seem to have resolved the JAR issue, but it now claims my code is using thread manipulation:</img>

However, the line it’s referencing does not open a new thread; it is synchronous (as recommended here):

Response response = client.newCall(request).execute();

I am unsure why the server is telling me I am attempting thread manipulation if I am using a synchronous method.


Look at the stack trace. The new thread is created in okhttp3.ConnectionPool.put (line 134)

For future reference: You’ll also need Okio, which OkHttp uses for fast I/O and resizable buffers.