Closed vickyramachandra closed 6 years ago
cc @hyangah
Sorry that I don't have time to look into this issue for now. I am guessing the plugin needs additional checks or dependency specification. Contribution is really welcome. Once it's fixed, I will happily build and upload a new version.
Hey hana, please look into it when you get time https://go-review.googlesource.com/c/mobile/+/94835 :)
Change https://golang.org/cl/94835 mentions this issue: mobile/misc/androidstudio: Fixing gobind build issues for Android builds
0.2.11 is out.
Thanks a lot @hyangah 👍:)
Thank you for actually fixing it @vickyramachandra
What version of Go are you using (
go version
)?go1.8.1 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64" GOBIN="" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="/Users/user/goprojects" GORACE="" GOROOT="/usr/local/go" GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64" GCCGO="gccgo" CC="clang" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/y8/ylh63k1106ldg8t7q3jrl701s3tf0r/T/go-build239147691=/tmp/go-build -gno-record-gcc-switches -fno-common" CXX="clang++" CGO_ENABLED="1" PKG_CONFIG="pkg-config" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2"
What did you do?
Gradle version - 4.5.1 Android plugin version - 3.0.1 I am using the android plugin gobindPlugin 0.2.10 to build my go source files and include them into the android app. I use the gradle wrapper to execute the gradle commands. When i execute one of the gradle build commands (eg ./gradlew build) for the very first time (i.e there is no prior gradle cache present -> .gradle/ folder isn't generated yet), i could see that the native files .so isn't packaged into my final apk. Hence when i run the app, finding the go methods fails, resulting in UnsatisfiedLinkError. However it is included in the successive builds (i.e when the gradle cache is once created). Also if i don't use the gobindPlugin and prebuild my go source files as .aar using the gomobile bind command and place them into the libs folder under the android app and include them as compile dependencies in my gradle script, the .so files are correctly packaged.
P.S - Make sure that app/build and app/src/main/jniLibs and .gradle/ directories aren't present inside the android project before any of the gradle commands are executed
What did you expect to see?
The native *.so packaged in my apk
What did you see instead?
Native files are missing in the apk