Android BugFix failed unexpected

2016-11-23  本文已影响116人  木猫尾巴

[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

上一篇下一篇

猜你喜欢

热点阅读