Open tangxuesong6 opened 2 years ago
What version of Android you are running on and what SDK version you're using? Thanks.
cc @hyangah @eliasnaur @changkun
What version of Android you are running on and what SDK version you're using? Thanks.
cc @hyangah @eliasnaur @changkun
Running on Android 10 (API 29). But i think the bug maybe because of my wrong use of gomobile bind
cmd, or it's gomobile's bug.
@cherrymui The builders on Corellium are running Android 9 and the installed NDK version is 23b.
@cherrymui The builders on Corellium are running Android 9 and the installed NDK version is 23b.
请问我是要换NDK版本吗? 当前是21.4.7075529
@cherrymui The builders on Corellium are running Android 9 and the installed NDK version is 23b.
请问我是要换NDK版本吗? 当前是
21.4.7075529
Can you maybe provide a minimal example to show your build process? The previous description is not clear as the project that you claim to build is not clear to us too.
@cherrymui The builders on Corellium are running Android 9 and the installed NDK version is 23b.
请问我是要换NDK版本吗? 当前是
21.4.7075529
Can you maybe provide a minimal example to show your build process? The previous description is not clear as the project that you claim to build is not clear to us too.
download some repositories(GO111MODULE="on"
)
go get -u github.com/anacrolix/torrent
go get -u github.com/dustin/go-humanize
here is my code(only 17 lines)
import (
"fmt"
"github.com/anacrolix/torrent"
"github.com/dustin/go-humanize"
)
func GetBtInfo() {
var t *torrent.Torrent
cfg := torrent.NewDefaultClientConfig()
cfg.DataDir = "./movie"
c, err := torrent.NewClient(cfg)
if err != nil {
fmt.Printf("err: %v", err)
}
url := "magnet:?xt=urn:btih:38F07BE8BBBBE4F2C6CBEC909F5C7BFAB8114185&dn=Resident%20Evil%20Welcome%20to%20Raccoon%20City%202021%20x264%20AAC%20800MB%20SD%20HDC&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A6969%2Fannounce&tr=udp%3A%2F%2F9.rarbg.to%3A2710%2Fannounce&tr=udp%3A%2F%2F9.rarbg.me%3A2780%2Fannounce&tr=udp%3A%2F%2F9.rarbg.to%3A2730%2Fannounce&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=http%3A%2F%2Fp4p.arenabg.com%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.torrent.eu.org%3A451%2Fannounce&tr=udp%3A%2F%2Ftracker.tiny-vps.com%3A6969%2Fannounce&tr=udp%3A%2F%2Fopen.stealth.si%3A80%2Fannounce"
t, err = c.AddMagnet(url)
if err != nil {
fmt.Printf("add err: %v", err)
}
<-t.GotInfo()
size := humanize.Bytes(uint64(t.Info().TotalLength()))
fmt.Printf("totalSize: %s, name: %s", size, t.Info().Name)
}
use gomobile
gomobile init
gomobile bind -v -target=android ./android/
this step will output an .aar file(named android.aar
)
copy the .aar
file to Android studio, and implementation
implementation files('libs/android.aar')
create a buttun in my Android app, when click, call the android.aar
method GetBtInfo
Android.getBtInfo();
build and run the Android project. the app run successfully. But when i click the buttun which call a method Android.getBtInfo();
, crashed. Here is the error log.
java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found
at java.lang.Runtime.loadLibrary0(Runtime.java:1071)
at java.lang.Runtime.loadLibrary0(Runtime.java:1007)
at java.lang.System.loadLibrary(System.java:1667)
at go.Seq.<clinit>(Seq.java:37)
at go.Seq.touch(Seq.java:50)
at android.Android.<clinit>(Android.java:12)
at android.Android.getBtInfo(Native Method)
I've also run into this issue. Same reproduction. One of the dependencies for anacrolix/torrent (probably anacrolix/go-libutp) uses C++.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?What did you do?
I use the open source project
github.com/anacrolix
, and want to build an Android aar for my project. Aftergomobile bind -v -target=android ./android/
, successfully exported an .aar file for me. Then i import the aar to my project useimplementation files('libs/bt.aar')
. The apk build successfully too. But when i launch the apk and cal the method in aar,likeSDK.Start
, my app crashed. Here is the error logWhat did you expect to see?
apk run successful
What did you see instead?
crashed