3

I am trying to use two different go packages in my android app project

I am using gomobile and each package is compiled with

gomobile bind --target=android

They are imported like this

implementation files("libs/packageone.aar")
implementation files("libs/packagetwo.aar")

and they work separateley, but they conflict when i try to run the app.

and I get the following error

Duplicate class go.Seq found in modules jetified-packageone-runtime (packageone.aar) and jetified-packagetwo-runtime (packagetwo.aar)
mama
  • 2,046
  • 1
  • 7
  • 24
  • It means that `go.Seq` class exists in both packages; and this confuses android studio when it comes to building the project – Zain Jan 29 '22 at 18:32
  • Yes but I guess `go.Seq` is generated by gomobile, and I don't know what I can do about it else than merging the 2 libraries into eachother before I import them to the android project. – mama Jan 29 '22 at 19:40

1 Answers1

0

I made an issue and got this response:

Unfortunately, that won't work.

The recommended workaround is to bind both packageone and packagetwo at once, and build one .aar.

https://github.com/golang/go/issues/56567

mama
  • 2,046
  • 1
  • 7
  • 24