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

Closed
brcomunique opened this issue Jan 17, 2017 · 1 comment
Closed

x/mobile: go package name conflict with type name #18689

brcomunique opened this issue Jan 17, 2017 · 1 comment
Labels
FrozenDueToAge mobile Android, iOS, and x/mobile
Milestone

Comments

@brcomunique
Copy link

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
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/danilolr/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.7.3/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.7.3/libexec/pkg/tool/darwin_amd64"
CC="clang"
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"
CXX="clang++"
CGO_ENABLED="1"

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{}
fmt.Println(d)
}

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/LoadJNI.java go/Seq.java go/Universe.java go/error.java golibdemo/Golibdemo.java failed: exit status 1
golibdemo/Golibdemo.java:9: error: class GoLibDemo is public, should be declared in a file named GoLibDemo.java
public final class GoLibDemo implements Seq.Proxy {
^
./golibdemo/Golibdemo.java:9: error: class GoLibDemo is public, should be declared in a file named GoLibDemo.java
public final class GoLibDemo implements Seq.Proxy {
^
golibdemo/Golibdemo.java:10: error: cannot access Golibdemo
static { Golibdemo.touch(); }
^
bad source file: ./golibdemo/Golibdemo.java
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 Android, iOS, and x/mobile label Jul 20, 2017
@eliasnaur
Copy link
Contributor

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

@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.
Labels
FrozenDueToAge mobile Android, iOS, and x/mobile
Projects
None yet
Development

No branches or pull requests

5 participants