Closed vboehr closed 1 year ago
Sorry I got stuck trying to install the NDK. There are downstream projects that have done this successfully I believe.
Download ndk from: https://dl.google.com/android/repository/android-ndk-r25b-linux.zip
gedit ~/.bashrc
In bashrc add the following line: export ANDROID_NDK_HOME=~/Documents/android-ndk-r25b-linux/android-ndk-r25b
after that: source ~/.bashrc
If you want to test if ANDROID_NDK_HOME is working: cd $ANDROID_NDK_HOME
I used "adb logcat" to get the runtime error and I got :+1:
java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found
I asked chatgpt to explain this runtime error and here its answer:
CHATGPT answer: Based on the error message you provided, it seems that the libc++_shared.so library is missing. This library is required by the libwetorrent_rebirth.so library, which is used by your app.
To fix this issue, you should make sure that you have included the libc++_shared.so library in your project and that it is being properly loaded by your app.
Here are some steps you can try to resolve this issue:
Check that you have included the libc++_shared.so library in your project. You can do this by looking for the library in your project's libs directory. If the library is missing, you may need to download it from the Android NDK and include it in your project.
If the libc++_shared.so library is present in your project, you should check that it is being properly loaded by your app. You can do this by checking your app's Android.mk or CMakeLists.txt file to ensure that the library is included in the LOCAL_LDLIBS variable.
If you are still having issues, you may want to try building your app with a different version of the Android NDK, as the version you are using may not be compatible with your project.
I hope this helps! Let me know if you have any further questions or concerns. what do you think?
I was able to build the apk now. The libc++_shared.so library is probably pulled in for the C++ part of go-libutp. You should include an appropriate build of libc++_shared.so file, or you could try building without libutp by passing --tags disable_libutp
to fyne, or disabling CGO entirely.
I would like to point out that if you add "disable_libutp" you will not be able to add UDP trackers and that would significantly limit the usefulness of this libray as most torrents use UDP trackers.
@EmmettKim93 if that's the case, it's a bug. uTP for peer protocol, and the use of UDP for UDP trackers are distinct.
I am sorry I thought that uTP for peer protocol was used for UDP trackers. I apologize.
All good, I appreciate people trying to help out with issues and discussion.
Thanks for the help provided. As you suggested adding "disable_libutp" solved the issue. Now I can use "anacrolix/torrent" in a fyne app !
Thanks again !
Note that I still think a better fix is out of scope for this repo, but I am glad you have found a sufficient workaround for now. I will close this for now. Thanks for following up with your resolution.
Describe the bug
I am trying to package an android torrent app that uses the following gui toolkit: https://github.com/fyne-io/fyne
Yet after installing the app on android and running it I get a black screen and app stops. How to reproduce
create a new go mod go mod init fynetorrentguiapp
go get fyne.io/fyne/v2
go get github.com/anacrolix/torrent
touch main.go
add an appicon.png file
add the example code include below
package the app as follow: ./fyne-cmd package -os android -appID com.fynetorrentguiapp.myapp -icon ./Icons/appicon.png
install the app on android and run it. Screenshots
No response Example code
Fyne version
v2.3.0 Go compiler version
go1.20 linux/amd64 Operating system
Linux Operating system version
Ubuntu 18.04.6 LTS (Bionic Beaver) Additional Information
./fyne-cmd env Go module info
cli_version="(devel)" go_mod="true" go_path="false" imported="true" path="***" version="v2.3.0" Go version info
version="go1.20 linux/amd64" Go environment info
CGO_ENABLED="1" GO111MODULE="" GOARCH="amd64" GOOS="linux" OS info
architecture="x86_64" home_url="https://www.ubuntu.com/" kernel="Linux 5.4.0-137-generic #154~18.04.1-Ubuntu SMP Tue Jan 10 16:58:20 UTC 2023" name="Ubuntu" version="18.04.6 LTS (Bionic Beaver)"