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: enable to import multiple aar files compiled by gomobile for one Android Studio project #63483

Open
MrKrisYu opened this issue Oct 10, 2023 · 10 comments
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

Comments

@MrKrisYu
Copy link

MrKrisYu commented Oct 10, 2023

The goal of this issue

Intended to fix issuse #56567

What do I modify for gomobile

  1. modify mobile/bind/java/Seq.java for extracting the java dependency(common Java dependencies later used for multiple AARs);
  2. mkdir a directory named "libs" for storing common java dependencies;
  3. modify mobile/cmd/gomobile/bind_androidapp.go to not cover go module in the class.jar of the final aar file.
  4. add some descriptions for how to using the new feature.

Details

more details, please see my fork : https://github.com/MrKrisYu/mobile

@seankhliao seankhliao changed the title New feature: support import multiple aar compiled by gomobile into a AndroidStudio Project. x/mobile: support import multiple aar compiled by gomobile into a AndroidStudio Project. Oct 10, 2023
@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label Oct 10, 2023
@gopherbot gopherbot added this to the Unreleased milestone Oct 10, 2023
@adonovan adonovan removed the pkgsite label Oct 12, 2023
@dmitshur dmitshur added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Oct 13, 2023
@dmitshur
Copy link
Contributor

CC @hajimehoshi.

@hajimehoshi
Copy link
Member

Does iOS have the same issue?

@hajimehoshi hajimehoshi changed the title x/mobile: support import multiple aar compiled by gomobile into a AndroidStudio Project. x/mobile: enable to import multiple aar files compiled by gomobile for one Android Studio project Oct 14, 2023
@viktorstrate
Copy link

@hajimehoshi

iOS gives the following warnings but it works:

objc[16342]: Class GoSeqRef is implemented in both /private/var/containers/Bundle/Application/77FA4478-30D1-4F07-BBA9-24F0DCDBD12F/Example.app/Frameworks/GoLib.framework/GoLib (0x10708fc08) and /private/var/containers/Bundle/Application/77FA4478-30D1-4F07-BBA9-24F0DCDBD12F/Example.app/Example (0x10551fa40).
One of the two will be used. Which one is undefined.

A similar warning is printed for following classes: Universeerror, goSeqDictionary, GoSeqRef, RefCounter, RefTracker.

@khayyamov
Copy link

khayyamov commented May 21, 2024

@MrKrisYu

Hey! thank you for this changes but when I completely do all steps which you are mention in your repository and run the below command it show me the error:

My last command: gomobile bind -target=android wrapTun -v

OUTPUT:
gomobile: /Users/zama/GoSdk/go1.19.2/bin/gobind -lang=go,java -outdir=/var/folders/dw/89x7xd492lz7s6v5dyhvstyh0000gn/T/gomobile-work-698989858 wrapTun -v failed: exit status 1

no exported names in the package "wrapTun"
no exported names in the package "-v"
no exported names in the package "wrapTun"
no exported names in the package "wrapTun"
no exported names in the package "wrapTun"
no exported names in the package "-v"
no exported names in the package "-v"
no exported names in the package "-v"

@musqdp
Copy link

musqdp commented May 30, 2024

After when I tried to compile https://github.com/2dust/AndroidLibXrayLite with https://github.com/MrKrisYu/mobile
I got an error message:
error: package go does not exist import go.Seq;

@banStayUpLate
Copy link

@hajimehoshi

iOS 给出了以下警告但它可以正常工作:

objc[16342]: Class GoSeqRef is implemented in both /private/var/containers/Bundle/Application/77FA4478-30D1-4F07-BBA9-24F0DCDBD12F/Example.app/Frameworks/GoLib.framework/GoLib (0x10708fc08) and /private/var/containers/Bundle/Application/77FA4478-30D1-4F07-BBA9-24F0DCDBD12F/Example.app/Example (0x10551fa40).
One of the two will be used. Which one is undefined.

以下类会打印类似的警告:Universeerror、goSeqDictionary、GoSeqRef、RefCounter、RefTracker。

Have you solved the problem that Class GoSeqRef is implemented in both

@khayyamov
Copy link

khayyamov commented Jul 4, 2024

banStayUpLate

https://github.com/khayyamov/mobile/tree/sagernet_editation_palestine
Please see the changes in my branch. I managed to fix this issue. The app runs like a normal one, but there are still some problems. I came to the conclusion that Go Mobile has no way to manage multiple AARs.

@banStayUpLate
Copy link

禁止熬夜

https://github.com/khayyamov/mobile/tree/wireguardwarp 请查看我的分支中的更改。我设法修复了这个问题。应用程序运行起来像普通应用程序一样,但仍然存在一些问题。我得出的结论是 Go Mobile 无法管理多个 AAR。

I compiled the xcframework, but the Class RefTracker is implemented in both also appeared in the iOS project

@khayyamov
Copy link

acctually this repo is pease of shit not working at all I change in my repo alll go refs to palestine still it not work
https://github.com/MrKrisYu/mobile

@banStayUpLate
Copy link

iOS 有同样的问题吗?

iOS also has the problem of multiple implementations of the same class:goSeqDictionary、GoSeqRef、RefCounter、RefTracker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
None yet
Development

No branches or pull requests

9 participants