golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
124.06k stars 17.68k forks source link

x/mobile/androidstudio: imported and not used compile error #12842

Closed TheTonsOfCode closed 9 years ago

TheTonsOfCode commented 9 years ago

I am newbie in Go on this moment, but I have problem which takes me about a week, and I don't make any progress. I build and run "Hello Gopher" on my phone, but when I would to try to that same with "basic script", I get errors. To today I know compilator not allow to stay in code imported things which are not used, but in this script wasn't imports like in error. I write there, becouse I could not to find anywhere solve of this problem by one week, and maybe that, can be not my fault. I use gcc: MinGW, AndroidStudio 1.2.2, Windows 8.0, Go 1.5.1 Here is error: http://pastebin.com/Cguaebny ,hello.go: http://pastebin.com/PPCn6sPE ,MainActivity: http://pastebin.com/61f8pSSb ,hello gradle: http://pastebin.com/cGnZ4Ak2 ,and My project is in folder: C:\gowork\src\golang.org\x\mobile\example\bind

I thought give everything which is needed, if anybody can help, Thanks in approve.

rakyll commented 9 years ago

You are trying to build a native Go mobile app as a binding. Please use gomobile build as it is explained at https://github.com/golang/go/wiki/Mobile#building-and-deploying-to-android.

Also note that we use the issue tracker is to file bugs, please use golang-nuts mailing list or the Go forum to ask user questions.

hyangah commented 9 years ago

The Go Mobile project targets two use cases

For details, see https://github.com/golang/go/wiki/Mobile

The 'basic' example is a Native Go app, and the 'bind' example is a Bind app example. I noticed you simply copied the basic example code to hello.go: 1) there is no exported names from your hello package, 2) golang.org/x/mobile/app is for the native app (The bind and the app packages don't mix well yet currently)

To build the 'basic' example, follow the instruction given in the https://godoc.org/golang.org/x/mobile/example/basic.

The error message must be improved.

BTW, golang-nuts@ or http://forum.golangbridge.org will be a better place for this type of questions.

gopherbot commented 9 years ago

CL https://golang.org/cl/15410 mentions this issue.