Compile issue in mbed-cloud-sdk:1.2.5

I try to add the dependency in my project as compile ‘com.arm.mbed.cloud.sdk:mbed-cloud-sdk:1.2.5’. It is throwing runtime exceptions as Execution failed for task ‘:app:transformDexArchiveWithDexMergerForDebug’.

com.android.build.api.transform.TransformException: com.android.dex.DexException: Multiple dex files define Lcom/arm/mbed/cloud/sdk/internal/JSON$1;

Has anyone came across this type of issue.

Hi ispacedroid, we’ll take a look and try to reproduce. Could you add some more details on your project and the tools / versions you are using. Thanks.

Hi Madchutney, Thanks for the reply.
I am trying to integrate in android Hello world application. below are the tools and versions I am using
Java - 1.8
Gradle 4.1
Android studio 3.0

This is way i am setting the dependency.
dependencies {
implementation 'com.android.support:appcompat-v7:25.1.0’
implementation 'com.android.support:design:25.1.0’
implementation 'com.android.support.constraint:constraint-layout:1.0.2’
compile ‘com.arm.mbed.cloud.sdk:mbed-cloud-sdk:1.2.5’
}

Hello ispacedroid,

Thank you for raising this issue and I can effectively reproduce the problem. I think I know its root cause but do not have a fix or a solution just yet: it seems to be caused by some code we generate and which would need changing. The SDK is currently built and tested on Oracle Java and may need some tweaking in the future to fully support android. Before this is the case though, we will try to provide you with a solution that can unblock you in the next release. In the meantime, could you create an issue on the Github repository so that you can track its progress.
Many thanks.

Hello ispacedroid,

I am writing to let you know that this bug has now been fixed as part of latest SDK release (i.e. 1.2.7).
Nevertheless, as mentioned in project’s Readme, current SDK build artefacts are not fully tailored for Android but can be used as is on this mobile platform. However, oltu dependency will have to be excluded to remove any compilation issue (e.g. Error converting bytecode to dex:\nCause: com.android.dex.DexException: Multiple dex files define Lorg/apache/oltu/oauth2/common/domain/credentials/Credentials). To do so, import the SDK in the gradle file, as follows:

implementation( 'com.arm.mbed.cloud.sdk:mbed-cloud-sdk:1.x.y' ){
    // Excluding a particular transitive dependency:
    exclude group: 'org.apache.oltu.oauth2'
}

We hope this will unblock you in your mobile application development.

Many thanks.