The ServiceStackIDEA plugin as been expanded to support IntelliJ and Maven projects as well as Android Studio and Gradle. This gives Java developers a familar experience when writing clients for ServiceStack in Android and any other Java client.
ServiceStackIDEA is a plugin for AndroidStudio to make working with ServiceStack services easier when building Android apps.
Using this plugin, you can add a ServiceStack reference to your existing Android application which generates required POJOs for interactive with the specific ServiceStack server.
Once added, the plugin also adds a reference to the ServiceStack.Android library which uses the ServiceStack.Client Java library to to make HTTP requests.
AndroidServiceClient client = new AndroidServiceClient("http://techstacks.io");
client.getAsync(new AppOverview(), new AsyncResult<AppOverviewResponse>() {
@Override
public void success(AppOverviewResponse response){
appOverviewResponse = response;
onUpdate(DataType.AppOverview);
}
});
This reduces the amount of code required when interacting with ServiceStack web services and also reduces guesswork around request and response types by using the generated POJOs.
ServiceStackIDEA is available to install straight from IntelliJ/Android Studio. To browse for the ServiceStack plugin:
- Goto the
Filemenu and selectSettings... - Select
Pluginsfrom the left hand side - Click the
Browse repositories...button at the bottom - Search for
ServiceStackand clickInstall plugin - Click
Restart <IDE>
If you are having trouble installing it directly from the IDE, you can also install it from the plugin zip file with the instructions below.
- download it here and save it locally.
- In Android Studio Go File -> Settings
- Search for "Install Plugin"
- Select "Install Plugin From Disk"
- Locate the downloaded plugin and Install
- Restart Android Studio.
To add a ServiceStack reference, right click on a file or folder inside your project module.
Alternatively, select the module/package folder/Java file and press Ctrl+Alt+Shift+R.
If you right click of an existing Java class (with a package) or package folder, the package field will be populated automatically.
Then provide the base URL to the ServiceStack server. This is usually the domian where your ServiceStack application is hosted.
Also, you can change the required file name for where the POJOs will be stored.
The Java file will then be added to the related package or /src/main/java folder of the module. If it has not already been added, the Module's build.gradle dependencies will be updated with the net.servicestack:android client dependency.
Once you have added a ServiceStack reference, it can be easily updated by using AndroidStudio Intention shortcut, usually Alt+Enter when in the file.
This will read all of the used options in the commented file header to generate a new request. This can be handy if the server has been updated and you need to update your client side POJOs, or if you want to include get/set methods by default.
For documentation on all options for both server and client, see the Java Add ServiceStack Reference wiki page.







