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 example doesn't work in Android Studio #25184

Closed
renatoathaydes opened this issue Apr 30, 2018 · 4 comments

Comments

Projects
None yet
4 participants
@renatoathaydes
Copy link

commented Apr 30, 2018

What version of Go are you using (go version)?

go version go1.10.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=""
GOCACHE="/Users/renato/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/renato/go"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/vz/dnr6kc0d4z76tk0mjxdbswxh0000gp/T/go-build312264261=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

  1. Checkout the gomobile project.
  2. Open the example/bind/android project with Android Studio (latest version: 3.1.2) as instructed in the README.

What did you expect to see?

The project should "Gradle sync" successfully when opened in Android Studio.
Furthermore, when editing the Android MainActivity.java, under the app dir, in Android Studio, the Go package-exported Java bindings (import hello.Hello;) should be reachable.

What did you see instead?

Android Studio's sync failed with:

Unable to resolve dependency for ':app@debug/compileClasspath': Failed to transform file 'hello.aar' to match attributes {artifactType=android-exploded-aar} using transform ExtractAarTransform

The package hello is not visible from the Java code in MainActivity.java.

@gopherbot gopherbot added this to the Unreleased milestone Apr 30, 2018

@gopherbot gopherbot added the mobile label Apr 30, 2018

@renatoathaydes

This comment has been minimized.

Copy link
Author

commented Apr 30, 2018

Strangely, the build succeeds:

image

Only the sync fails:

image

Is this something I should report to Android Studio?

@sisyphsu

This comment has been minimized.

Copy link

commented May 2, 2018

meet same issue...

@wseternal

This comment has been minimized.

Copy link

commented May 8, 2018

I found a temporary walk-around in my environment, use plugin 'com.android.tools.build:gradle:2.3.2' instead of "3.x.x" in build.gradle of top directory, then, change the 'implementation' to 'compile' in app/build.gradle would work.

@gopherbot

This comment has been minimized.

Copy link

commented Oct 10, 2018

Change https://golang.org/cl/141057 mentions this issue: misc,example/bind/hello: remove the Gradle plugin

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