I am trying to run the simple Jaunt example from the website and got an error for Null Pointer Exception. I am not sure what to do because there is very little support for using Jaunt in Android Studio. Here is my code:
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
try{
UserAgent userAgent = new UserAgent();
userAgent.visit("http://jaunt-api.com/examples/signup.htm");
}
catch(JauntException e){
System.out.println(e);
}
}
}
Here is the error I got when I ran it:
java.lang.NullPointerException: Attempt to invoke interface method 'void com.android.okhttp.internal.http.Transport.writeRequestHeaders(com.android.okhttp.Request)' on a null object reference
The error was on the userAgent.visit line.
This is where I got the code: http://jaunt-api.com/jaunt-tutorial.htm