The problem is that Protocol Buffers for Java uses the Getter/Setter convention and the go file already has methods that start with Get<WhateverYourThingIs>. I did a pretty hacky work around. I ran sed 's/Get/GoGet/' on the code output from the protocol buffer right before I call gomobile bind -target=android That compiles the Android .aar file just fine.
On Tuesday, December 5, 2017 at 2:03:37 PM UTC-7, William Quintal wrote: > > I have the same issue , did you find a solution ? > > Le mercredi 8 novembre 2017 19:49:17 UTC-5, Jay Graves a écrit : >> >> I've been trying to use Protobufs as a data transport between go code and >> native iOS and Android code. This has worked great on iOS as I can use this >> to output go and objc code to work with the objects. >> protoc --go_out=. --objc_out=. *.proto >> >> However, when I try to run >> gomobile bind -target=android . >> >> I get the following error. >> Skabber:go-protobuf-test jay$ gomobile bind -target=android . >> gomobile: go build -pkgdir=/Users/jay/go/pkg/gomobile/pkg_android_arm - >> buildmode=c-shared -o=/var/folders/c3/8ydc1rk94kd7p9bcrkh855000000gn/T/ >> gomobile-work-563639487/android/src/main/jniLibs/armeabi-v7a/libgojni.so >> /var/folders/c3/8ydc1rk94kd7p9bcrkh855000000gn/T/gomobile-work-563639487/ >> androidlib/main.go failed: exit status 2 >> # >> _/var/folders/c3/8ydc1rk94kd7p9bcrkh855000000gn/T/gomobile-work-563639487/gomobile_bind >> java_protobuftest.c:101:1: error: redefinition of >> 'Java_protobuftest_Config_getCurrentversion' >> java_protobuftest.c:42:1: note: previous definition is here >> java_protobuftest.c:116:1: error: redefinition of >> 'Java_protobuftest_Config_getUpgrademsg' >> java_protobuftest.c:58:1: note: previous definition is here >> java_protobuftest.c:131:1: error: redefinition of >> 'Java_protobuftest_Config_getUpgradeurl' >> java_protobuftest.c:66:1: note: previous definition is here >> java_protobuftest.c:146:1: error: redefinition of >> 'Java_protobuftest_Config_getDatatypes' >> java_protobuftest.c:50:1: note: previous definition is here >> java_protobuftest.c:221:1: error: redefinition of >> 'Java_protobuftest_Config_DataType_getInvalidatedate' >> java_protobuftest.c:178:1: note: previous definition is here >> java_protobuftest.c:236:1: error: redefinition of >> 'Java_protobuftest_Config_DataType_getUrl' >> java_protobuftest.c:186:1: note: previous definition is here >> java_protobuftest.c:251:1: error: redefinition of >> 'Java_protobuftest_Config_DataType_getCache' >> java_protobuftest.c:170:1: note: previous definition is here >> java_protobuftest.c:266:1: error: redefinition of >> 'Java_protobuftest_Config_DataType_getAutorefresh' >> java_protobuftest.c:162:1: note: previous definition is here >> java_protobuftest.c:341:1: error: redefinition of >> 'Java_protobuftest_Config_DataTypes_getPackage' >> java_protobuftest.c:298:1: note: previous definition is here >> java_protobuftest.c:356:1: error: redefinition of >> 'Java_protobuftest_Config_DataTypes_getRequest' >> java_protobuftest.c:306:1: note: previous definition is here >> java_protobuftest.c:371:1: error: redefinition of >> 'Java_protobuftest_Config_DataTypes_getMilestones' >> java_protobuftest.c:290:1: note: previous definition is here >> java_protobuftest.c:386:1: error: redefinition of >> 'Java_protobuftest_Config_DataTypes_getMilestonerange' >> java_protobuftest.c:282:1: note: previous definition is here >> >> Is this a problem with gomobile, protobuf, or my code? >> >> Thanks! >> > -- 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.