Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/mobile: Multiple dex files define Lgo/LoadJNI; #17278

joeblew99 opened this issue Sep 29, 2016 · 1 comment
mobile NeedsInvestigation


Copy link

@joeblew99 joeblew99 commented Sep 29, 2016

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

x-MacBook-Pro:mobile-sdk apple$ go version
go version go1.7.1 darwin/amd64

What operating system and processor architecture are you using (go env)?

x-MacBook-Pro:mobile-sdk apple$ gomobile version
gomobile version +9640137 Tue Sep 27 16:37:51 2016 +0000 (android,ios); androidSDK=/Users/apple/Library/Android/sdk/platforms/android-24

x-MacBook-Pro:mobile-sdk apple$ go env
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/wp/ff6sz9qs6g71jnm12nj2kbyw0000gp/T/go-build085920980=/tmp/go-build -gno-record-gcc-switches -fno-common"

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'. java.util.concurrent.ExecutionException: Multiple dex files define Lgo/LoadJNI;

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.

@joeblew99 joeblew99 changed the title x-mobile: Android Dex clash x-mobile: Android - Multiple dex files define Lgo/LoadJNI; Sep 29, 2016
@quentinmit quentinmit changed the title x-mobile: Android - Multiple dex files define Lgo/LoadJNI; x/mobile: Multiple dex files define Lgo/LoadJNI; Oct 4, 2016
@quentinmit quentinmit added this to the Unreleased milestone Oct 4, 2016
Copy link

@quentinmit quentinmit commented Oct 4, 2016

I think this is WAI; my understanding is that Go currently does not support linking two separately-built archives into a single program. This is true both on Android and on desktop OSes.

-> @crawshaw who is working on improving this; David, is this a dupe of an existing bug?

@quentinmit quentinmit added the NeedsInvestigation label Oct 4, 2016
@gopherbot gopherbot added the mobile label Jul 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
mobile NeedsInvestigation
None yet

No branches or pull requests

4 participants