Using the WebThing's Framework on Android/starting a webthingserver

Hey,
I’m developing an Android app using Android Studio and Java for an university project and for that I need to start a WebThingServer to communicate the interactions with the app to the WebThings Gateway but i’m getting the following exception on the “server.start(false)”: NetworkOnMainThreadException. I’ve tried using the doInBackground() method but i still can’t get it to work. Has anyone experienced this kind of error or would have an idea on how i could fix it?