mavlink / MAVSDK-Java

MAVSDK client for Java.
68 stars 40 forks source link

Requesting a new release #83

Closed divyanshupundir closed 2 years ago

divyanshupundir commented 2 years ago

@JonasVautherin can you please create a new Maven release with the latest stable version of MAVSDK?

JonasVautherin commented 2 years ago

For some reason I had issues building because of some deprecations. I started updating the tooling here: https://github.com/mavlink/MAVSDK-Java/pull/84.

But I have an issue with ./gradlew build:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':mergeDebugNativeLibs'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.MergeNativeLibsTask$MergeNativeLibsTaskWorkAction
   > 2 files found with path 'lib/arm64-v8a/libmavsdk_server.so' from inputs:
      - /home/jones/Documents/px4/sdk/mavsdk-java/mavsdk_server/build/intermediates/merged_jni_libs/debug/out/arm64-v8a/libmavsdk_server.so
      - /home/jones/Documents/px4/sdk/mavsdk-java/mavsdk_server/build/intermediates/cxx/Debug/3y4z4f6x/obj/arm64-v8a/libmavsdk_server.so
     If you are using jniLibs and CMake IMPORTED targets, see
     https://developer.android.com/r/tools/jniLibs-vs-imported-targets
divyanshupundir commented 2 years ago

A somewhat hacky solution is to add this to the build.gradle.

android {
...
    packagingOptions {
        pickFirst '**/libmavsdk_server.so'
    }
...
}

I thought that removing the extractMavsdkServer task should make it work since the docs stated:

External native build now automatically packages those libraries, so explicitly packaging the library with jniLibs results in a duplicate. To avoid the build error, move the prebuilt library to a location outside jniLibs or remove the jniLibs configuration from your build.gradle file.

This didn't work. So it looks like for a better solution, we'll need to do something with the external build process. I'm not sure what that is at the moment.

But for the time being, the pickFirst method does the trick as I am able to build it using your PR.

JonasVautherin commented 2 years ago

I extracted them in src/main/prebuiltLibs instead of src/main/jniLibs and it built, not sure if it runs :sweat_smile:. Would you mind trying it? I'll update the sdk package next :+1:

divyanshupundir commented 2 years ago

Sure just give me a day. I'll try it with the server V1.0.3

divyanshupundir commented 2 years ago

It looks like it's working great!

I tried it with mavsdk-server v1.0.8, using the protos at 5cb33bbe.

The only problem I found was with slf4j-api:2.0.0-alpha6. It is still unstable and is creating problems in mavsdk dependants. Please change it to the latest stable 1.7.35

JonasVautherin commented 2 years ago

I have issues publishing with the new tooling, I'll check again tomorrow :+1:

JonasVautherin commented 2 years ago

I published 1.0.0, should be on mavenCentral in a few hours. Let me know if it works :crossed_fingers:

divyanshupundir commented 2 years ago

Awesome! I'll test it out on hardware today. Thanks.

divyanshupundir commented 2 years ago

Looks like something's gone wrong. io/mavsdk/mavsdk/1.0.0 is available on repo.maven and is working properly.

mavsdk-1 0 0

But it looks like the aar file is missing for mavsdk-server/1.0.0 and hence Gradle isn't able to find it.

mavsdk-server-1 0 0

JonasVautherin commented 2 years ago

Ok I released 1.0.1, would you mind trying it when it's on mavenCentral? Thanks for the help :laughing:

divyanshupundir commented 2 years ago

I did a few flights with our drones and it looks like it's working great.

Thanks for the help

Glad to help and thank you for the release.