0

I am trying to build an Android Library for existing Java Library. In my Java library there is annotation called org.wso2.siddhi.annotation.Extension When I try to add this annotation to a class I get the following error.

Error:Execution failed for task ':siddhiservice:transformClassesAndResourcesWithSyncLibJarsForDebug'.
> java.util.zip.ZipException: duplicate entry: META-INF/annotations/org.wso2.siddhi.annotation.Extension

This is my class implementation.

package org.wso2.siddhiservice.sensors.proximity;

import org.wso2.siddhi.annotation.Example;
import org.wso2.siddhi.annotation.Extension;

@Extension(
        name = "proximity",
        namespace="source",
        description = "Get events from the proximity sensor",
        examples = @Example(description = "TBD",syntax = "TBD")
)
public class ProximitySensorSource extends Source {
}

If I just remove the @extension and clean the project it works fine. Problem happens only when I add the annotation.These are my libraries.

enter image description here

What is the solution for this?

chamathabeysinghe
  • 858
  • 2
  • 13
  • 34

1 Answers1

0

use annotationProcessor in application gradle.build file

    implementation files ('libs/Siddhi.jar');
    annotationProcessor files ('libs/Siddhi.jar')

Also, use { transitive = false } to avoid duplicate files

implementation (group: 'org.wso2.extension.siddhi.io.tcp', name: 'siddhi-io-tcp', version: '2.0.15'){ transitive = false }

It works for me

enter image description here

Amarjit Dhillon
  • 2,718
  • 3
  • 23
  • 62