-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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: support multiple independent bindings in the same app #15956
Comments
when I delete one of them arr module,I build apk successful! |
FAILURE: Build failed with an exception.
|
can not use more aar !!!! |
oh my god,very boring |
got the identical thing today. enabling MultDex is possible apparently as fix in Android Studio. But dont knwo too much. I wonder if devs really need more than one golang dependency in their Android apps ? |
Hello, I got the same issue using two go packages that translates into two android modules, but the go directory in the .aar files are identical. Using multidex didn't cut it for me, because I ended up with following error:
I tried to exclude the LoadJNI.class from one of the dependencies using gradle without luck :/ Any ideas? |
Is it not a possibility to merge them to one go package and deal with only one .aar? |
Gomobile doesn't support multiple independent instances in the same app. As @hyangah points out, list multiple packages to |
This would be nice. Not a great developer experience for Java developers to have to learn Go building tools just 2 use more than 1 go library in their apps. I'd expect to see meteoric growth in the use of Go on Android if this is fixed. |
Is this going to be fixed anytime soon? This is a really big blocker as the number of go-mobile libraries is growing and it is going to create a lot of compatibility issues in the feature. |
I don't have plans to work on it, sorry. |
I got the same problem on Android(The two aar supported by different team). First, I think it is just the problem of .so conflict. So, I modify the source of go-mobile and changed the name of .so just like "libgojniX.so". Then I got another problem: "duplicate class go.Seq". Continue to modify the source of go-mobile, change the default package "go" to "go.xxx". Then I got the class go.xxx.Seq. Import the new aar to the project, It was compiled successfully. But, when I run the app. It throws some go-runtime error:
Is there any way to decouple them(go-runtime&logic.so)? |
There is no easy fix for two instances of the Go runtime in one process. Even if you could get it to work it would be wasteful. Why not build the two projects together into one aar? |
Could u please give me more details about modifying the so name and the default package name "go", Since I mainly work on Android, I'm confusing about which file to change, and how to let it take effect |
In the "real world", Sometimes we need to work with multiple teams(which may not open sourced), And there is no easy way they sharing code or the procedure, So I think this puzzle may not be such meanless, And I just trying to hack it |
@eliasnaur So The question is, Is there anything improved since this talk made this possible? (Maybe my logic too simple, But at least one process load two libgojni.so(maybe two go runtime?) and it worked. |
One fundamental restriction to multiple independent Go runtimes on Android: there is only one TLS_SLOT_APP (on Android 10+). See https://golang.org/cl/170117/ and https://golang.org/issue/29674. Have you seen As far as I know, Another approach that could work is |
just FYI, on the apple side, using two gomobile for context: we want to distribute apple-targeted libraries (via cocoapods) with gomobile .xcframeworks and until this is supported we would need to produce monolithic libraries that contain and expose every go-side functionalities the users native code needs to access I think |
So, does some one found at least somehow reliable solution except for merging two libs together? Maybe something with those build modes? |
This issue also makes publishing Flutter packages that depend on Gomobile libraries somewhat pointless, as you aren't able to import more than one Flutter plugin that depends on Gomobile. And as those are different packages (possibly packaged by different maintainers), it doesn't seem that the "combine them into one AAR" approach would work. |
I'm having the same problem and it looks like I have to give up one of the go libraries, which will cause my workload to become too high! Hope to solve this problem soon!! |
I'm having the same problem in 2024! any idea how to fix this issue? |
keep an eye on it |
me 2 |
Please answer these questions before submitting your issue. Thanks!
go version
)?1.5
go env
)?windows amd64
I make arr module by use gomobile bind common, but I have two different package hello and halou,so I do this:
as follow
gomobile bind -target=android golang.org/x/mobile/example/bind/hello
gomobile bind -target=android golang.org/x/mobile/example/bind/halou
I get two aar module,then import them by android studio ,
when I build apk,happen erro messsage
Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lgo/LoadJNI;
:app:transformClassesWithDexForDebug FAILED
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
I know resason that two arr include two jar file,but them have same LoadJNI.class and Seq.class,
so conflict!
I want to know that how to resolve it by good way?
The text was updated successfully, but these errors were encountered: