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: Java to Go bindings crashes with java.lang.UnsatisfiedLinkError #12951

Closed
sureshg opened this issue Oct 15, 2015 · 4 comments

Comments

Projects
None yet
4 participants
@sureshg
Copy link

commented Oct 15, 2015

I have a sample Android app with Java to Go bindings, built using gomobile bind command. When i try to run this code on Nexus 5 (Android 6) it's always crashing with java.lang.UnsatisfiedLinkError.../libgojni.so: has text relocations. I am not sure whether this is the right repo to report x/mobile issues. Reporting it here because i didn't find any option in golang/mobile

SDK Version

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }

Go bind gradle plugin

go version go1.5.1 darwin/amd64

plugins {
    id "org.golang.mobile.bind" version "0.2.2"
}
10-15 16:08:26.634 1632-1662/io.test.gopherandy I/OpenGLRenderer: Initialized EGL, version 1.4
10-15 16:08:28.242 1632-1632/io.test.gopherandy D/AndroidRuntime: Shutting down VM
10-15 16:08:28.256 1632-1632/io.test.gopherandy E/AndroidRuntime: FATAL EXCEPTION: main
10-15 16:08:28.256 1632-1632/io.test.gopherandy E/AndroidRuntime: Process: io.test.gopherandy, PID: 1632
10-15 16:08:28.256 1632-1632/io.test.gopherandy E/AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: /data/app/io.test.gopherandy-2/lib/arm/libgojni.so: has text relocations
10-15 16:08:28.256 1632-1632/io.test.gopherandy E/AndroidRuntime:     at java.lang.Runtime.loadLibrary(Runtime.java:372)
10-15 16:08:28.256 1632-1632/io.test.gopherandy E/AndroidRuntime:     at java.lang.System.loadLibrary(System.java:1076)
10-15 16:08:28.256 1632-1632/io.test.gopherandy E/AndroidRuntime:     at go.LoadJNI.<clinit>(LoadJNI.java:5)
10-15 16:08:28.256 1632-1632/io.test.gopherandy E/AndroidRuntime:     at java.lang.Class.classForName(Native Method)
10-15 16:08:28.256 1632-1632/io.test.gopherandy E/AndroidRuntime:     at java.lang.Class.forName(Class.java:324)
10-15 16:08:28.256 1632-1632/io.test.gopherandy E/AndroidRuntime:     at java.lang.Class.forName(Class.java:285)
10-15 16:08:28.256 1632-1632/io.test.gopherandy E/AndroidRuntime:     at go.Seq.<clinit>(Seq.java:23)
10-15 16:08:28.256 1632-1632/io.test.gopherandy E/AndroidRuntime:     at go.hello.Hello.Greetings(Hello.java:13)

@sureshg sureshg changed the title Java to Go bindings crashes with java.lang.UnsatisfiedLinkError x/mobile: Java to Go bindings crashes with java.lang.UnsatisfiedLinkError Oct 16, 2015

@crawshaw

This comment has been minimized.

Copy link
Contributor

commented Oct 16, 2015

This is the same as #12890.

I believe you can build with targetSdkVersion=22, but this may have been fixed by 82d11f. Could you try syncing to the latest gomobile and running init and bind again?

@crawshaw

This comment has been minimized.

Copy link
Contributor

commented Oct 16, 2015

@sureshg please reopen this issue if this is not fixed by the latest version of gomobile.

@crawshaw crawshaw closed this Oct 16, 2015

@sureshg

This comment has been minimized.

Copy link
Author

commented Oct 16, 2015

@crawshaw yeah cleaned up the existing gomobile (if that matters) and ran the following commands with new gradle plugin ("org.golang.mobile.bind" version "0.2.3") . Still having the same issue. Did i miss anything?

  $  go get -u golang.org/x/mobile/cmd/gomobile && gomobile init
  $ ./gradlew -b gobuild/build.gradle gobind 
0-15 19:26:31.474 22685-22685/io.test.gopherandy E/AndroidRuntime: FATAL EXCEPTION: main
10-15 19:26:31.474 22685-22685/io.test.gopherandy E/AndroidRuntime: Process: io.test.gopherandy, PID: 22685
10-15 19:26:31.474 22685-22685/io.test.gopherandy E/AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: /data/app/io.test.gopherandy-2/lib/arm/libgojni.so: has text relocations
10-15 19:26:31.474 22685-22685/io.test.gopherandy E/AndroidRuntime:     at java.lang.Runtime.loadLibrary(Runtime.java:372)
10-15 19:26:31.474 22685-22685/io.test.gopherandy E/AndroidRuntime:     at java.lang.System.loadLibrary(System.java:1076)
10-15 19:26:31.474 22685-22685/io.test.gopherandy E/AndroidRuntime:     at go.LoadJNI.<clinit>(LoadJNI.java:5)
10-15 19:26:31.474 22685-22685/io.test.gopherandy E/AndroidRuntime:     at java.lang.Class.classForName(Native Method)
10-15 19:26:31.474 22685-22685/io.test.gopherandy E/AndroidRuntime:     at java.lang.Class.forName(Class.java:324)
10-15 19:26:31.474 22685-22685/io.test.gopherandy E/AndroidRuntime:     at java.lang.Class.forName(Class.java:285)
10-15 19:26:31.474 22685-22685/io.test.gopherandy E/AndroidRuntime:     at go.Seq.<clinit>(Seq.java:23)
10-15 19:26:31.474 22685-22685/io.test.gopherandy E/AndroidRuntime:     at go.hello.Hello.Greetings(Hello.java:13)
10-15 19:26:31.474 22685-22685/io.test.gopherandy E/AndroidRuntime:     at io.test.gopherandy.MainActivity$1.onClick(MainActivity.java:26)```
@ekrivenja

This comment has been minimized.

Copy link

commented Oct 16, 2015

@sureshg, update just gomobile is not enough, see #12890 last messages.

@golang golang locked and limited conversation to collaborators Oct 17, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.