An Android multi-platform problem compatible solution idea

Source: Internet
Author: User

Questions: use as the signature package, in the debugging has been used 5.0 of the Xiaomi phone can be normal operation, 4.4 of the Lenovo phone Flash back, 5.1 of the simulator on the flash back.

Thrown: Java.lang.unsatisfiedlinkerror,classloader cannot find the relevant so library.


Solution Ideas:

The conjecture is related to the CPU architecture, and the query is as follows (Cat/proc/cpuinfo):

Simulator: The computer is using Intel's CPU x86_64 architecture

Lenovo: Processor:armv7 Processor Rev 2 (v7l) armeabi-v7a

Xiaomi: Processor:aarch64 Processor Rev 2 (aarch64) arm64-v8a


Question one, what CPU architectures does Android support?

The answer is easy to search: Android currently supports 7 architectures

    1. x86_64

    2. x86

    3. Mips64

    4. Mips

    5. armeabi-v7a

    6. Armeabi

    7. arm64-v8a


Question two, how does the system find so library?

Find so Library rules:

when running, the system will find the so library in the Jnidirs directory, and the corresponding directory will be found based on the current platform schema. There is a rule in this which is the culprit of the problem. when you provide only the Armeabi directory, armeabi-v7a, ARM64-V8A architecture program will go to Armeabi, and when you also provide armeabi-v7a, armeabi-v8a directory, And there is no corresponding so library, the system will not go to Armeabi inside the search, directly can not find an error.

There are seven of these directories in the signature package, which is discussed later in this question.

Validation conjecture:

app-release.apk use packaging software to open, delete the armeabi-v7a directory, found that the Lenovo phone can run normally (to Armeabi inside looking for). Remove the x86_64 folder, the emulator can run normally (go to x86 inside to look for).


Question three, the signature package why all seven directories have?

Corresponds to seven directories in the Jnidirs directory. Open the signature package and discover that all seven directories have one. It is strange that my project is only x86, Armeabi and arm64-v8a three types of so libraries. Open Other directory discovery is only one so file: libgenius_graphics.so. Think of the solution to this from where, find Build-gradle when found: Compile ' net.qiujuer.genius:graphics:2.0.0-beta8 ' very similar, this is an open source UI library. The guess is to introduce this library to automatically generate libgenius_graphics.so files under each platform at compile time. Remove it, rebuild, this is true, leaving only the original three folders.


Question four, Armeabi can be compatible with x86 platform?

And when I even removed the x86 folder, it could not be installed on the emulator at all, prompting: Install_failed_no_matching_abis. Prove that the x86 architecture does not look for the Armeabi directory. When you want to run the app on a x86 machine, be sure to get the corresponding x86 version so library file.


This article is from a "sword Siege" blog, please make sure to keep this source http://weijiancheng.blog.51cto.com/10190955/1891876

An Android multi-platform problem compatible solution idea

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.