On Thursday, September 22, 2016 at 5:34:24 PM UTC+2, Peter Kleiweg wrote:
>
> I try the examples on  https://github.com/golang/go/wiki/Mobile
>
> Native applications -> Building and deploying to Android works fine.
>
> On "SDK applications and generating bindings" I get into problems.
>
> It says: 
>
>     go get -d golang.org/x/mobile/example/bind/...
>
> I get:
>
>     warning: "golang.org/x/mobile/example/bind/..." matched no packages
>     can't load package: package golang.org/x/mobile/example: no buildable 
> Go source files in /home/peter/go/src/golang.org/x/mobile/example
>
>
That's odd, and it should definitely work. With Go 1.7.1 and after removing 
my existing $GOPATH/golang.org directory out of the way, running

$ go get -d golang.org/x/mobile/example/bind/. 
<http://golang.org/x/mobile/example/bind/>..

outputs no error and downloads golang.org/x/mobile just fine. Which version 
of Go are you using? Regardless of this issue, I recommend 1.7.1 because it 
contains fixes for several issues on mobiles, in particular iOS.

 

> But this works:
>
>     go get -d github.com/golang/mobile/example/bind/...
>
> But then building in Studio fails.
>
> I edit example/bind/android/hello/build.gradle to set GO and GOPATH, and I 
> change pkg from "golang.org/x/mobile/example/bind/hello" to "
> github.com/golang/mobile/example/bind/hello"
>
> When I do Build -> Make Project, I get:
>
>     Executing tasks: [clean, :app:generateDebugSources, 
> :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, 
> :app:generateDebugAndroidTestSources, :app:compileDebugSources, 
> :app:compileDebugUnitTestSources, :app:compileDebugAndroidTestSources]
>
>     Configuration on demand is an incubating feature.
>     Incremental java compilation is an incubating feature.
>     :app:clean
>     :hello:clean UP-TO-DATE
>     :app:preBuild UP-TO-DATE
>     :app:preDebugBuild UP-TO-DATE
>     :app:checkDebugManifest
>     :app:preReleaseBuild UP-TO-DATE
>     :hello:gobind
>     :app:prepareAndroidHelloUnspecifiedLibrary
>     :app:prepareComAndroidSupportAppcompatV72211Library
>     :app:prepareComAndroidSupportSupportV42211Library
>     :app:prepareDebugDependencies
>     :app:compileDebugAidl
>     :app:compileDebugRenderscript
>     :app:generateDebugBuildConfig
>     :app:generateDebugResValues
>     :app:generateDebugResources
>     :app:mergeDebugResources
>     :app:processDebugManifest
>     :app:processDebugResources
>     :app:generateDebugSources
>     :app:mockableAndroidJar UP-TO-DATE
>     :app:preDebugUnitTestBuild UP-TO-DATE
>     :app:prepareDebugUnitTestDependencies
>     :app:preDebugAndroidTestBuild UP-TO-DATE
>     :app:prepareDebugAndroidTestDependencies
>     :app:compileDebugAndroidTestAidl
>     :app:processDebugAndroidTestManifest
>     :app:compileDebugAndroidTestRenderscript
>     :app:generateDebugAndroidTestBuildConfig
>     :app:generateDebugAndroidTestResValues
>     :app:generateDebugAndroidTestResources
>     :app:mergeDebugAndroidTestResources
>     :app:processDebugAndroidTestResources
>     :app:generateDebugAndroidTestSources
>     :app:incrementalDebugJavaCompilationSafeguard
>     :app:compileDebugJavaWithJavac
>     :app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have 
> changed, no previous execution, etc.).
>     
>     /home/peter/go/src/
> github.com/golang/mobile/example/bind/android/app/src/main/java/org/golang/example/bind/MainActivity.java:27:
>  
> error: cannot find symbol
>             String greetings = Hello.Greetings("Android and Gopher");
>                                     ^
>       symbol:   method Greetings(String)
>       location: class Hello
>     1 error
>     
>     :app:compileDebugJavaWithJavac FAILED
>
>
>
>

Java methods names were recently changed to lowercase, but the examples 
weren't updated. That's unfortunate, but thank you for reporting. FWIW, 
I've mailed https://go-review.googlesource.com/c/29594/ to fix the two 
examples and to comment out the GO, GOMOBILE and GOPATH settings from the 
build.gradle file. They're more confusing than helpful.

  - elias

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to