Mashape Blog

Rumors aboard Mashape's spaceship

Chris Ismael
This post will show you how to get Unirest-java running on your Android projects.  Unirest is a lightweight HTTP client library with port available in many languages. This is a follow-up to “How to install Unirest using the Maven assembly plugin”.  The steps are similar, with the addition of a Maven (shader) plugin that relocates some packages in order to work around dependency errors when using the uber jar in an Android project. (In case you’re interested, the error you’ll get is ”java.lang.NoSuchFieldError: org.apache.http.message.BasicLineFormatter.INSTANCE”). Let’s start: 1.  Follow Steps 1 and 2 from the Unirest-java/Maven tutorial.
Chris Ismael
Managing dependencies for your Java applications is difficult, unless you have Maven!  Maven is an Apache build manager for Java projects.  In this post, we will use a Maven plugin (Maven Assembly) to pull all the unirest-java dependencies in one bundle/jar file. Let’s get started (the steps below assume you already have Java and Git installed): Update: If you’re building for Android, please refer to this post.

1.  Download/Install Maven

To check if you already have Maven in your machine, run "mvn -version" in your Terminal.  OS X prior to Maverick already comes with Maven.  If…