mardi 24 septembre 2019

Problem adding Robolectric in Android instrumentation test

I'm testing and Android app using various frameworks like Robolectric and Mockito. I have an app main project and a related "Libraries" project, linked with the first one and shared with other app. I need to test a Service class in my Libraries using instrumentation test and Robolectric (that I used massively in my JVM test also in Libraries). When I add

androidTestImplementation 'org.robolectric:robolectric:4.3'

to my Module:libraries build.gradle the build goes fine, but when I launch my instrumented test i got this error

Duplicate class com.google.protobuf.AbstractMessage found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.AbstractMessage$Builder found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.AbstractMessageLite found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.AbstractMessageLite$Builder found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.AbstractMessageLite$Builder$LimitedInputStream found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.AbstractParser found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.BlockingRpcChannel found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.BlockingService found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.BoundedByteString found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.BoundedByteString$1 found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.BoundedByteString$BoundedByteIterator found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.ByteString found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.ByteString$1 found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.ByteString$ByteIterator found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.ByteString$CodedBuilder found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.ByteString$Output found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.CodedInputStream found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.CodedInputStream$RefillCallback found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.CodedInputStream$SkippedDataSink found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.CodedOutputStream found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.CodedOutputStream$ByteBufferOutputStream found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.CodedOutputStream$OutOfSpaceException found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$1 found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$DescriptorProto found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$DescriptorProto$1 found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$DescriptorProto$Builder found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$DescriptorProto$ExtensionRange found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$DescriptorProto$ExtensionRange$1 found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$DescriptorProto$ExtensionRange$Builder found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$DescriptorProto$ExtensionRangeOrBuilder found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$DescriptorProtoOrBuilder found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$EnumDescriptorProto found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$EnumDescriptorProto$1 found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$EnumDescriptorProto$Builder found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$EnumDescriptorProtoOrBuilder found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$EnumOptions found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$EnumOptions$1 found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$EnumOptions$Builder found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$EnumOptionsOrBuilder found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$EnumValueDescriptorProto found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
Duplicate class com.google.protobuf.DescriptorProtos$EnumValueDescriptorProto$1 found in modules lifesense_ble_v3.3.7.jar (lifesense_ble_v3.3.7.jar) and protobuf-java-2.6.1.jar (com.google.protobuf:protobuf-java:2.6.1)
...
Duplicate class org.apache.maven.artifact.installer.ArtifactInstallationException found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.installer.ArtifactInstaller found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.installer.DefaultArtifactInstaller found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.manager.ChecksumFailedException found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.manager.DefaultWagonManager found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.manager.DefaultWagonManager$1 found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.manager.DefaultWagonManager$2 found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.manager.DefaultWagonProviderMapping found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.manager.WagonComponentConfigurator found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.manager.WagonConfigurationException found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.manager.WagonManager found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.manager.WagonProviderMapping found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.metadata.AbstractArtifactMetadata found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.metadata.ArtifactMetadata found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.metadata.ArtifactMetadataSource found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.metadata.ResolutionGroup found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.repository.ArtifactRepository found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.repository.ArtifactRepositoryFactory found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.repository.ArtifactRepositoryPolicy found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.repository.DefaultArtifactRepository found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.repository.DefaultArtifactRepositoryFactory found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.repository.layout.LegacyRepositoryLayout found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.AbstractRepositoryMetadata found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.DefaultRepositoryMetadataManager found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.GroupRepositoryMetadata found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.Metadata found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-repository-metadata-2.2.1.jar (org.apache.maven:maven-repository-metadata:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.Plugin found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-repository-metadata-2.2.1.jar (org.apache.maven:maven-repository-metadata:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.RepositoryMetadata found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.RepositoryMetadataDeploymentException found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.RepositoryMetadataInstallationException found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.RepositoryMetadataManager found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.RepositoryMetadataReadException found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutionException found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.RepositoryMetadataStoreException found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.Snapshot found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-repository-metadata-2.2.1.jar (org.apache.maven:maven-repository-metadata:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-manager-2.2.1.jar (org.apache.maven:maven-artifact-manager:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.Versioning found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-repository-metadata-2.2.1.jar (org.apache.maven:maven-repository-metadata:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-repository-metadata-2.2.1.jar (org.apache.maven:maven-repository-metadata:2.2.1)
Duplicate class org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Writer found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-repository-metadata-2.2.1.jar (org.apache.maven:maven-repository-metadata:2.2.1)
Duplicate class org.apache.maven.artifact.resolver.AbstractArtifactResolutionException found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.resolver.ArtifactCollector found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)
Duplicate class org.apache.maven.artifact.resolver.ArtifactNotFoundException found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1)


Go to the documentation to learn how to Fix dependency resolution errors.

I tried to exclude, for example, the Protobuff using:

androidTestImplementation 'org.robolectric:robolectric:4.3' {
        exclude group: 'com.google.protobuf', module: 'protobuf-java'
    }

obtain in this case

ERROR: Could not find method org.robolectric:robolectric:4.3() for arguments [build_byuvhyax0s1u9skwzk0q7eedm$_run_closure2$_closure16@4efcea4d] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Open File

These are my dependecies in gradle:

[app]

dependencies {

    implementation "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion"
    implementation "com.android.support:preference-v7:$rootProject.supportLibraryVersion"
    implementation "com.android.support:support-v4:$rootProject.supportLibraryVersion"
    implementation "com.google.code.gson:gson:$rootProject.gsonVersion"
    implementation "commons-io:commons-io:$rootProject.commonsioVersion"

    // Dependencies for ButterKnife
    implementation "com.jakewharton:butterknife:$rootProject.butterknifeVersion"
    annotationProcessor "com.jakewharton:butterknife-compiler:$rootProject.butterknifeVersion"

    // Dependencies for Dagger
    implementation "com.google.dagger:dagger:$rootProject.daggerVersion"
    annotationProcessor "com.google.dagger:dagger-compiler:$rootProject.daggerVersion"

    // Dependencies for RxBinding
    implementation "com.jakewharton.rxbinding2:rxbinding:$rootProject.rxBindingVersion"

    // Dependencies for Rxjava2 and RxAndroid
    implementation "io.reactivex.rxjava2:rxandroid:$rootProject.rxAndroidVersion"
    implementation "io.reactivex.rxjava2:rxjava:$rootProject.rxJavaVersion"

    // Dependencies for Retrofit
    implementation "com.squareup.retrofit2:retrofit:$rootProject.retrofitVersion"
    implementation "com.squareup.retrofit2:converter-simplexml:$rootProject.retrofitConverterSimplexmlVersion"
    implementation "com.jakewharton.retrofit:retrofit2-rxjava2-adapter:$rootProject.retrofitRxjavaAdapterVersion"
    implementation "com.squareup.okhttp:okhttp:$rootProject.okhttpVersion"

    // Dependencies for Room
    implementation "android.arch.persistence.room:runtime:$rootProject.roomVersion"

    // Glide
    implementation "com.github.bumptech.glide:glide:$rootProject.glideVersion"

    // AndroidX
    testImplementation ('androidx.test:rules:1.1.0') {
        exclude module:'kxml2'
    }

    // Dependencies for JUnit
    testImplementation "junit:junit:$rootProject.junitVersion"
    androidTestImplementation "junit:junit:$rootProject.junitVersion"

    // Mockito framework
    testImplementation 'org.mockito:mockito-core:2.4.0'
    testImplementation "org.robolectric:robolectric:4.3"

    // Multidex
    implementation "com.android.support:multidex:$rootProject.multidexVersion"

    implementation project(path: ':libraries')
}

[libraries]

dependencies {
    implementation "com.android.support:support-v4:$rootProject.supportLibraryVersion"
    implementation "com.google.code.gson:gson:$rootProject.gsonVersion"
    implementation "commons-io:commons-io:$rootProject.commonsioVersion"

    // Dependencies for RxBinding
    implementation "com.jakewharton.rxbinding2:rxbinding:$rootProject.rxBindingVersion"

    // Dependencies for Rxjava2 and RxAndroid
    implementation "io.reactivex.rxjava2:rxandroid:$rootProject.rxAndroidVersion"
    implementation "io.reactivex.rxjava2:rxjava:$rootProject.rxJavaVersion"

    // Dependencies for Retrofit
    implementation "com.squareup.retrofit2:retrofit:$rootProject.retrofitVersion"
    implementation "com.squareup.retrofit2:converter-simplexml:$rootProject.retrofitConverterSimplexmlVersion"
    implementation "com.jakewharton.retrofit:retrofit2-rxjava2-adapter:$rootProject.retrofitRxjavaAdapterVersion"
    implementation "com.squareup.okhttp:okhttp:$rootProject.okhttpVersion"

    // Dependencies for Room
    // Room (use 1.1.0-alpha1 for latest alpha)
    implementation "android.arch.persistence.room:runtime:$rootProject.roomVersion"
    implementation "android.arch.persistence.room:rxjava2:$rootProject.roomVersion"
    annotationProcessor "android.arch.persistence.room:compiler:$rootProject.roomVersion"

    implementation "com.android.support:support-annotations:$rootProject.supportLibraryVersion"
    //implementation "org.apache.httpcomponents:httpcore:$rootProject.httpcoreVersion"

    // Dependencies for JUnit
    testImplementation "junit:junit:$rootProject.junitVersion"
    androidTestImplementation "junit:junit:$rootProject.junitVersion"
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'

    androidTestImplementation ('androidx.test:runner:1.1.0') {
        exclude module:'kxml2'
    }

    testImplementation ('androidx.test:runner:1.1.0') {
        exclude module:'kxml2'
    }

    androidTestImplementation ('androidx.test:rules:1.1.0') {
        exclude module:'kxml2'
    }

    testImplementation ('androidx.test:rules:1.1.0') {
        exclude module:'kxml2'
    }

    // Mockito framework
    testImplementation 'org.mockito:mockito-core:2.13.0'
    testImplementation "org.robolectric:robolectric:4.3"
    androidTestImplementation 'org.robolectric:robolectric:4.3' 

    // Multidex
    implementation "com.android.support:multidex:$rootProject.multidexVersion"

    api files('libs/lifesense_ble_v3.3.7.jar')
    api files('libs/pulselibrary-release.aar')
    api files('libs/CreativeHealth_pc60nw.jar')
}

I don't understand the problem deeply and I didn't find a much about it. How can i solve this conflicts due to run my instrumented test?

Thanks in advance

Aucun commentaire:

Enregistrer un commentaire