Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/mobile: regression error #17277

joeblew99 opened this issue Sep 29, 2016 · 7 comments

x/mobile: regression error #17277

joeblew99 opened this issue Sep 29, 2016 · 7 comments


Copy link

@joeblew99 joeblew99 commented Sep 29, 2016


Please answer these questions before submitting your issue. Thanks!

Hey, i hit a nasty regression bug.
It also broke the Android and IOS code too.

I fixed it by removing the offending func call. See below.
But now all the front end code is broken, and i cant work out how the android code should be :)

What version of Go are you using (go version)?


What operating system and processor architecture are you using (go env)?

x-MacBook-Pro:mobile-sdk apple$ gomobile version
gomobile version +9640137 Tue Sep 27 16:37:51 2016 +0000 (android,ios); androidSDK=/Users/apple/Library/Android/sdk/platforms/android-24

x-MacBook-Pro:mobile-sdk apple$ go env
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/wp/ff6sz9qs6g71jnm12nj2kbyw0000gp/T/go-build094029375=/tmp/go-build -gno-record-gcc-switches -fno-common"

JAVA_HOME (exported)            /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home                                 
ANDROID_HOME (exported)         /Users/apple/Library/Android/sdk                                                   
Android SDK Platform Tools      /Users/apple/Library/Android/sdk/platform-tools 

What did you do?

You can git clone from the tree

This code cause gomobile bind . to fail:

Removing just that func allows the build to work.

First potential issue i see is that this is very typical legal go code !!! Me and a ton of code sets a value on a struct via a func. Its basically a Set property accessor in the Java world if i remember correctly.
Anyway, this break this git repo, and a fair bit of other code.

Second thing, is that the code now looks very different in the Android world.
This now longer works at all.

import go.logpackermobilesdk.Logpackermobilesdk;
// ...
try {
    client = Logpackermobilesdk.NewClient("", "dev", android.os.Build.MODEL);

    msg = client.NewMessage();
    msg.setMessage("Crash is here!");
    // Use another optional setters for msg object

    client.Send(msg); // Send will return Cluster response
} catch (Exception e) {
    // Cannot connect to Cluster or validation error
Copy link

@eliasnaur eliasnaur commented Sep 29, 2016

You say somethings fails, but what is the error message?

If the error is an unexpected crash and you'd like me to investigate further, please try to make a stand alone reproducer I can run (with gradle). One way is to modify the gomobile "bind" example to exercise the problematic code.

Copy link

@joeblew99 joeblew99 commented Sep 29, 2016

ok i will make a fork of it al for you now..

1 minute

Copy link

@joeblew99 joeblew99 commented Sep 29, 2016


just gomobile build from root.

then adjust the build.gradle (Module:logpackermobilesdk)
to have the correct path to the .aar

that shoudl then build. But you wont get an .apk, because i cant work out the correct code to instantiate the code at the android level now. Things have changed a few bit it seems.

Anyway have a look

The 2nd thing i want to remind about is the OLD code regression bug

This used to work for gomobile, and then broke recently, and i guess it will break lots of others..

Let me knwo if i can help...

Copy link

@eliasnaur eliasnaur commented Sep 29, 2016

Thank you. You've provided me with an example, but not yet the error message. What is the error message you're seeing that you don't expect? You seem to mention two issues, please provide an error message for each issue.

Copy link

@joeblew99 joeblew99 commented Sep 29, 2016

in android studio

on build > APK, you get error message

Information:Gradle tasks [:app:assembleDebug]
Error:(54, 39) error: cannot find symbol class Client
Error:(56, 39) error: cannot find symbol class Message
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
Information:BUILD FAILED
Information:Total time: 4.166 secs
Information:3 errors
Information:0 warnings
Information:See complete output in console

Copy link

@eliasnaur eliasnaur commented Sep 29, 2016

Those errors are caused by a recent change to gomobile that moves the generated classes out of the main package class. Replace

    Logpackermobilesdk.Client ...
    Logpackermobilesdk.Message ...


    Client ...
    Message ...

and remember to import go.logpackermobilesdk.Client and go.logpackermobilesdk.Message.

This is an unfortunate backwards incompatible change, but not a bug.

Copy link

@joeblew99 joeblew99 commented Sep 30, 2016

thank you.. Now all works.

I prefer the new structure of the Android Java code... Its much more intuitive. big thankyou...
its pretty neat how you take golang struct, and generate all the Java Get and Set Property Accessors.

The 2nd error message was related to the first. Property Accessors in golang were clashing with the ones you generate in Java.

@joeblew99 joeblew99 closed this Sep 30, 2016
@golang golang locked and limited conversation to collaborators Sep 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.