Android BugFix failed unexpected e_machine

[TOC]

Error Inof

java.lang.UnsatisfiedLinkError:...failed unexpected e_machine: 3...
    at java.lang.Runtime.loadLibrary(..)

Reason

*.so file are not running at taget platform

Fix

check *.so file ELF info by readelf

# Linux
readelf -h *.so
# Recursion so
find armeabi-v7a -name "*.so" | xargs readelf -h | egrep "File|Class|Machine"
# IN Mac
arm-linux-androideabi-readelf -h *.so | egrep "Class|Machine"
# Recursion so
find armeabi-v7a -name "*.so" | xargs arm-linux-androideabi-readelf -h | egrep "File|Class|Machine"

arm-linux-androideabi-readelf at android-ndk-r12b/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/ or use find android-ndk-x -name "arm-linux-androideabi-readelf"

Right Info like

File: armeabi-v7a/libxxx.so
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              DYN (Shared object file)
  Machine:                           ARM
  Version:                           0x1
  Entry point address:               0x0
  Start of program headers:          52 (bytes into file)
  Start of section headers:          688204 (bytes into file)
  Flags:                             0x5000000, Version5 EABI
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         8
  Size of section headers:           40 (bytes)
  Number of section headers:         24
  Section header string table index: 23

Class and Machine must be the same platform

More Info see http://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容