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: go package name conflict with type name #18689

brcomunique opened this issue Jan 17, 2017 · 1 comment


None yet
5 participants
Copy link

commented Jan 17, 2017

Please answer these questions before submitting your issue. Thanks!

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

Danilos-MacBook-Pro:golibdemo danilolr$ go version
go version go1.7.3 darwin/amd64

What operating system and processor architecture are you using (go env)?

Danilos-MacBook-Pro:golibdemo danilolr$ go env
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/ry/l4yf7vwd5rbdydhtn03qfmnm0000gn/T/go-build870546491=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I create a new package to be used as a gomobile library.
The package contains only one file (golibdemo.go) with this content :

package golibdemo

import "fmt"

type GoLibDemo struct {

func main() {
d := GoLibDemo{}

Then I execute the command :

gomobile bind -target android

What did you expect to see?

The .aar file build.

What did you see instead?

A error message and a zero size aar file :

Danilos-MacBook-Pro:golibdemo danilolr$ gomobile bind -target android
gomobile: javac -d /var/folders/ry/l4yf7vwd5rbdydhtn03qfmnm0000gn/T/gomobile-work-713371376/javac-output -source 1.7 -target 1.7 -bootclasspath /Users/danilolr/Library/Android/sdk/platforms/android-24/android.jar go/ go/ go/ go/ golibdemo/ failed: exit status 1
golibdemo/ error: class GoLibDemo is public, should be declared in a file named
public final class GoLibDemo implements Seq.Proxy {
./golibdemo/ error: class GoLibDemo is public, should be declared in a file named
public final class GoLibDemo implements Seq.Proxy {
golibdemo/ error: cannot access Golibdemo
static { Golibdemo.touch(); }
bad source file: ./golibdemo/
file does not contain class golibdemo.Golibdemo
Please remove or make sure it appears in the correct subdirectory of the sourcepath.
3 errors

Danilos-MacBook-Pro:golibdemo danilolr$ ls -l
total 8
-rw-r--r-- 1 danilolr staff 0 Jan 17 17:09 golibdemo.aar
-rw-r--r-- 1 danilolr staff 110 Jan 17 16:51 golibdemo.go
Danilos-MacBook-Pro:golibdemo danilolr$

Please say me more

The problem only happens when building the library to android on OSX.
I am able to build it to android on linux and to iOS on OSX.

@rakyll rakyll added this to the Unreleased milestone Jan 17, 2017

@bradfitz bradfitz added the mobile label Jul 20, 2017


This comment has been minimized.

Copy link

commented Mar 16, 2018

I believe this is a dup of #23327, which is fixed.

@eliasnaur eliasnaur closed this Mar 16, 2018

@golang golang locked and limited conversation to collaborators Mar 16, 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.