golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
124.06k stars 17.68k forks source link

Gomobile not building on android/arm64 #13177

Closed garry415 closed 9 years ago

garry415 commented 9 years ago

gomobile bind -target android only generates an android/arm library, however many new phones such as the Nexus 5x are android/arm64. The generated libraries are incompatible and return an error when accessed.

11-05 16:37:18.387  2581  2664 E AndroidRuntime: FATAL EXCEPTION: AsyncTask #2
...
11-05 16:37:18.387  2581  2664 E AndroidRuntime:    at java.lang.Thread.run(Thread.java:818)
11-05 16:37:18.387  2581  2664 E AndroidRuntime: Caused by: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/co.myapp/base.apk"],nativeLibraryDirectories=[/data/app/co.myapp/lib/arm64, /data/app/co.myapp/base.apk!/lib/arm64-v8a, /vendor/lib64, /system/lib64]]] couldn't find "libgojni.so"
11-05 16:37:18.387  2581  2664 E AndroidRuntime:    at java.lang.Runtime.loadLibrary(Runtime.java:367)
11-05 16:37:18.387  2581  2664 E AndroidRuntime:    at java.lang.System.loadLibrary(System.java:1076)
11-05 16:37:18.387  2581  2664 E AndroidRuntime:    at go.LoadJNI.<clinit>(LoadJNI.java:5)
11-05 16:37:18.387  2581  2664 E AndroidRuntime:    at java.lang.Class.classForName(Native Method)
11-05 16:37:18.387  2581  2664 E AndroidRuntime:    at java.lang.Class.forName(Class.java:324)
11-05 16:37:18.387  2581  2664 E AndroidRuntime:    at java.lang.Class.forName(Class.java:285)
11-05 16:37:18.387  2581  2664 E AndroidRuntime:    at go.Seq.<clinit>(Seq.java:23)
11-05 16:37:18.387  2581  2664 E AndroidRuntime:    at go.mobilepgp.Mobilepgp.NewKeyPair(Mobilepgp.java:168)
11-05 16:37:18.387  2581  2664 E AndroidRuntime:    at co.charge.messenger.util.EncryptionUtil$GenerateKeyTask.doInBackground(EncryptionUtil.java:140)
11-05 16:37:18.387  2581  2664 E AndroidRuntime:    at co.charge.messenger.util.EncryptionUtil$GenerateKeyTask.doInBackground(EncryptionUtil.java:117)
11-05 16:37:18.387  2581  2664 E AndroidRuntime:    at android.os.AsyncTask$2.call(AsyncTask.java:295)
11-05 16:37:18.387  2581  2664 E AndroidRuntime:    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
11-05 16:37:18.387  2581  2664 E AndroidRuntime:    ... 4 more

Gomobile saves libgojni.so under armeabi-v7a but probably should compile android/arm64 and place under arm64-v8a.

~/p/c/m/b/lib» tree                                                                                             e2ee!?
.
├── arm64-v8a
│   └── libgif.so
├── armeabi
│   └── libgif.so
├── armeabi-v7a
│   ├── libgif.so
│   ├── libgojni.so
│   ├── librsjni.so
│   └── libRSSupport.so
├── mips
│   ├── libgif.so
│   ├── librsjni.so
│   └── libRSSupport.so
├── mips64
│   └── libgif.so
├── x86
│   ├── libgif.so
│   ├── librsjni.so
│   └── libRSSupport.so
└── x86_64
    └── libgif.so

7 directories, 14 files
hyangah commented 9 years ago

duplicate of #10743