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: Android gobindPlugin doesn't package *.so into the apk for the very first build #23766

Closed
vickyramachandra opened this issue Feb 10, 2018 · 7 comments

Comments

Projects
None yet
4 participants
@vickyramachandra
Copy link

commented Feb 10, 2018

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

@gopherbot gopherbot added this to the Unreleased milestone Feb 10, 2018

@gopherbot gopherbot added the mobile label Feb 10, 2018

@vickyramachandra

This comment has been minimized.

Copy link
Author

commented Feb 11, 2018

@hyangah

This comment has been minimized.

Copy link
Contributor

commented Feb 15, 2018

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.

@vignesh-ramachandra

This comment has been minimized.

Copy link

commented Feb 16, 2018

Hey hana, please look into it when you get time https://go-review.googlesource.com/c/mobile/+/94835 :)

@gopherbot

This comment has been minimized.

Copy link

commented Feb 16, 2018

Change https://golang.org/cl/94835 mentions this issue: mobile/misc/androidstudio: Fixing gobind build issues for Android builds

@hyangah

This comment has been minimized.

Copy link
Contributor

commented Feb 20, 2018

0.2.11 is out.

@vickyramachandra

This comment has been minimized.

Copy link
Author

commented Feb 20, 2018

Thanks a lot @hyangah 👍:)

@hyangah

This comment has been minimized.

Copy link
Contributor

commented Feb 20, 2018

Thank you for actually fixing it @vickyramachandra

@golang golang locked and limited conversation to collaborators Feb 20, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.