x/mobile: com.android.dex.DexException: Multiple dex files define Lgo/LoadJNI; #17278
Labels
mobile
Android, iOS, and x/mobile
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?What did you do?
I was working in Android Studio, and had one aar from a go project referenced as a aar module.
I added a 2nd aar as a module from a golang project.
In the "Project Structure.." i made sure both aar modules were dependencies of the app module.
and when building my APK got:
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
How to reproduce ?
Take 2 simple gomobile compiled projects, and build their .aar. Hello World & FooBar will do..
Add the first to an android project, reference it and build. All is good.
Add the second aar to the same android project.
Make sure the app module has a dependency on both aar modules..
Now , all is bad :) Multiple dex files error occurs on build...
How to stop the bug ?
Remove one of the aar modules from the Project Structure app module dependencies.
But thats not fixing the problem, but thats how you can toggle the error happening easily..
Not sure whats going ok...
Why this sucks ?
I can work around it by making sure all my code fits into a single golang project. Composition is easy with golang.
But it makes me wonder what the bug is, and i also dont knwo if this is a deal breaker for others.
The text was updated successfully, but these errors were encountered: