This is the Java frontend implementation to MAVSDK.
It is organized as follows:
- The examples directory contains Java and Android examples using the sdk.
- The sdk directory contains the actual SDK.
- The mavsdk_server directory contains the Android library exposing
mavsdk_server
.
The fastest way to start is to follow the instructions in the README of the java-client example. For Android, the android-client is the next step.
MAVSDK-Java is distributed through MavenCentral, meaning that it can be imported using gradle with:
dependencies {
...
implementation 'io.mavsdk:mavsdk:0.4.0'
...
}
For Android, mavsdk_server
is distributed as an Android library (aar
):
dependencies {
...
implementation 'io.mavsdk:mavsdk:0.4.0'
implementation 'io.mavsdk:mavsdk-server:0.4.0'
...
}
Java/Android coding style is ensured using CheckStyle with the Google style.
A checkstyle
task is defined in the root build.gradle
of each project and can be run as follows:
$ ./gradlew checkstyle
The build
task depends on checkstyle
, meaning that $ ./gradlew build
runs the checks as well.
There exist a plugin for CheckStyle in JetBrains' IDEs.
- Install the plugin called "CheckStyle-IDEA" in IntelliJ / Android-Studio.
- Import the checkstyle configuration as a code style scheme in Settings > Editor > Code Style > Java > Manage... >
Import... by selecting "CheckStyle configuration" and then browsing to
config/checkstyle/checkstyle.xml
. - In Settings > Other Settings > Checkstyle, change the "Scan Scope" to "Only Java sources (including tests)".
- Still in Settings > Other Settings > Checkstyle, add a new configuration file and browse to
config/checkstyle/checkstyle.xml
.
In IntelliJ / Android-Studio's bottom task bar, you should see a "CheckStyle" tab. It will allow you to select your configuration with the "Rules" dropdown-list, and to run the analysis on your code.
Note that by default, the IDE will not run checkstyle when building the project (whereas $ ./gradlew build
always does it).
In IntelliJ / Android-Studio, the IDE might force the order of the imports in a way that is not following the checkstyle rules. For some reason, this is not set when importing checkstyle.xml
as a code style scheme. However, it can be manually updated in Settings > Code Style > Java > Import Layout.
Both sdk and mavsdk_server are released with Maven. Publishing can be done through a gradle task:
./gradlew uploadArchives
This task requires a few secrets in gradle.properties
:
signing.keyId=<keyId>
signing.password=<password>
signing.secretKeyRingFile=<ring_file>
ossrhUsername=<username>
ossrhPassword=<password>