Just one more information: I am calling from my go code like this: RBinding.GetStringFromJava()
On Tuesday, September 10, 2019 at 4:56:00 PM UTC+5:30, Jay Sharma wrote: > > Hello @elias, > > I tried the following: > > 1. Created a java class : > > package reversebinding; > > public class RBinding { > public static String getStringFromJava() { > return "Hello from java !!"; > } > } > > 2. Generated the .class file for this file. > > 3. Generated the android binding using gomobile tool and used > -classpath="Path to my .class file" > > 4. Binding is generated successfully. > > *But when I used that generated (.aar) file in my android app and tried to > trigger the api it is crashing; * > > 2019-09-10 16:36:54.199 9400-9430/com.sample E/GoLog: 2019/09/10 11:06:54 > test.go:134: testFunction [Test] > 2019-09-10 16:36:54.199 9400-9430/com.sample E/GoLog: 2019/09/10 11:06:54 > test.go:136: [Test] Now going to call a java system function > (System.CurrentTimeMillis())..... > 2019-09-10 16:36:54.200 9400-9434/com.sample E/GoLog: 2019/09/10 11:06:54 > test.go:138: [Test] Called java function return value is: 1568113614199 > 2019-09-10 16:36:54.200 9400-9434/com.sample E/GoLog: 2019/09/10 11:06:54 > test.go:140: [Test] Now going to call my java function..... > 2019-09-10 16:36:54.203 9400-0/com.sample E/Go: panic: runtime error: > invalid memory address or nil pointer dereference > 2019-09-10 16:36:54.203 9400-0/com.sample E/Go: [signal SIGSEGV: > segmentation violation code=0x1 addr=0x0 pc=0x7568010708] > 2019-09-10 16:36:54.203 9400-0/com.sample E/Go: goroutine 17 [running, > locked to thread]: > 2019-09-10 16:36:54.203 9400-0/com.sample E/Go: > test.testFunction(0x4000000738) > 2019-09-10 16:36:54.203 9400-0/com.sample E/Go: > /home/test/2019/test/test.go:141 +0x190 > 2019-09-10 16:36:54.203 9400-0/com.sample E/Go: > main.proxytest__testFunction(...) > 2019-09-10 16:36:54.203 9400-0/com.sample com.sample E/Go: > /tmp/gomobile-work-071468276/src/gobind/go_testmain.go:199 > 2019-09-10 16:36:54.203 9400-0/com.sample E/Go: > main._cgoexpwrap_5427a26f9204_proxytest__testFunction(0x8020080280200802) > 2019-09-10 16:36:54.203 9400-0/com.sample E/Go: _cgo_gotypes.go:606 > +0x1c > 2019-09-10 16:36:54.204 9400-9423/com.sample A/libc: Fatal signal 6 > (SIGABRT), code -6 in tid 9423 (Thread-2) > > *Can you please provide you opinion. Let me know if any other information > is needed. * > > Thanks.... > > > On Monday, September 9, 2019 at 5:40:25 PM UTC+5:30, Elias Naur wrote: >> >> On Mon Sep 9, 2019 at 3:09 AM Jay Sharma wrote: >> > >> > *Next I want to try with my own classes in java.. I want to define >> class >> > and call it from go. * >> > *Can you please suggest, in that case how to build with gomobile ?* >> > >> >> I think you can use the -classpath option to gomobile. >> >> -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/9957ce97-b649-4733-9b46-2232f88c55a3%40googlegroups.com.