Thanks! Not using the packages was the issue.
On Friday, October 19, 2018 at 10:10:25 AM UTC+2, Elias Naur wrote: > > You're not using the imports. To avoid generating for the entire Android > API, the reverse generator only generates bindings referenced by your code. > For examples, see golang.org/x/mobile/bind/testdata/testpkg/javapkg. This > works for me: > > $ gomobile bind golang.org/x/mobile/bind/testdata/testpkg/javapkg > > I agree that the error message could be better, or that an empty packages > could be generated for your example. Reverse bindings are not of the same > quality as regular bindings, I'm sorry. > > - elias > > On Friday, October 19, 2018 at 9:38:33 AM UTC+2, Tim Cooijmans wrote: >> >> Hi, >> >> I just tried but it doesn't work: >> $ ls >> /Users/timcooijmans/Development/AndroidSDK/platforms/android-27/android.jar >> >> /Users/timcooijmans/Development/AndroidSDK/platforms/android-27/android.jar >> $ gomobile bind -v -bootclasspath >> /Users/timcooijmans/Development/AndroidSDK/platforms/android-27/android.jar >> git.xxx.com/test >> type-checking package "git.xxx.com/test" failed >> (/Users/timcooijmans/Development/xxx/src/git.xxx.com/test/gobind.go:4:2: >> could not import Java/android/content (cannot find package >> "Java/android/content" in any of: >> /usr/local/Cellar/go/1.11.1/libexec/src/Java/android/content (from >> $GOROOT) >> /Users/timcooijmans/Development/xxx/src/Java/android/content (from >> $GOPATH))) >> >> gomobile: /Users/timcooijmans/Development/xxx/bin/gobind -lang=go,java >> -outdir=/var/folders/wz/4c7lp4w92y99_2bmpyx0j8sm0000gn/T/gomobile-work-615111792 >> >> -bootclasspath=/Users/timcooijmans/Development/AndroidSDK/platforms/android-27/android.jar >> >> git.xxx.com/test failed: exit status 1 >> >> >> On Friday, October 19, 2018 at 9:30:04 AM UTC+2, Elias Naur wrote: >>> >>> I see. For Android API, you'll need to specify the bootstrap classpath >>> by setting the gomobile -bootclasspath flag to point to the android.jar >>> from the Android SDK that matches your platform version. For example: >>> >>> $ gomobile bind -bootclasspath <SDK>/platforms/android-27/android.jar >>> <Go pkg> >>> >>> If you need access to your own Java classes, use the -classpath flag. >>> >>> - elias >>> >>> On Friday, October 19, 2018 at 8:49:50 AM UTC+2, Tim Cooijmans wrote: >>>> >>>> Simple example: >>>> package test >>>> >>>> >>>> import ( >>>> "Java/android/content" >>>> "Java/android/content/pm" >>>> ) >>>> >>>> >>>> >>>> >>>> func Test() string { >>>> return "Hello world" >>>> } >>>> >>>> >>>> returns >>>> $ gomobile bind -v git.xxx.com/test >>>> type-checking package "git.xxx.com/test" failed >>>> (/Users/xxx/Development/xxx/src/git.xxx.com/test/gobind.go:4:2: could >>>> not import Java/android/content (cannot find package >>>> "Java/android/content" >>>> in any of: >>>> /usr/local/Cellar/go/1.11.1/libexec/src/Java/android/content (from >>>> $GOROOT) >>>> /Users/xxx/Development/xxx/src/Java/android/content (from $GOPATH))) >>>> >>>> gomobile: /Users/xxx/Development/xxx/bin/gobind -lang=go,java >>>> -outdir=/var/folders/wz/4c7lp4w92y99_2bmpyx0j8sm0000gn/T/gomobile-work-238062479 >>>> >>>> git.xxx.com/test failed: exit status 1 >>>> >>>> >>>> On Thursday, October 18, 2018 at 11:28:25 PM UTC+2, Elias Naur wrote: >>>>> >>>>> Does >>>>> >>>>> gomobile bind <Go package> >>>>> >>>>> work? If not, what does it say? >>>>> >>>>> - 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.