To execute the ADB command:
Cat/proc/cpuinfo
Corresponding folder
AArch64 = = arm64-v8a
ARMv7 = = armeabi-v7a
............ such as
The rest of you find it yourself.
Note: Here I want to explain a development to pay attention to the problem.
First explain the mechanism of the APK package so file in Android studio and the machine automatically select so library file execution problem
1.APK packaging will be the project Armeabi and other files in the original file name directly into the APK, if there are multiple module in the same folder, the module in the so file will be merged into a folder.
For example: module has so folder Armeabi,armeabi-v7a,x86,x86_64, ( remember Armeabi in the specific several so files )
There is so folder armeabi,armeabi-v7a,x86 in module( remember several so files in Armeabi )
So the last package generated in the APK file is like this
It's obvious that the same folder in the two module has merged so files together, so the apk will eventually merge so files. if one of your two module has another so folder and content, the APK will still merge the so folder, but only the so file in the module. For example, in the picture above, the first module has "x86_64" This folder, and the second module does not, but the APK will find that there is a folder inside, but only a module in the so file, here will cause a problem, want to know to look down.
2. After packaging the APK file installed to the phone, the phone will be based on their own CPU structure to select the corresponding so folder to execute so file, the current mobile phone has a variety of CPU architecture, such as: armeabi,armeabi-v7a,arm64-v8a,x86,x86_64, You will find that this is consistent with the so folder name in the Android project above, which also shows that the phone will choose to execute the files in the so folder. ( Note: The CPU of the arm64 architecture, if found in the APK arm64-v8a folder, then will be found directly inside to execute the so library file, if not this folder will find Armeabi files under the so File execution )
Understand the above knowledge and then look at the following:
1. If you use multiple module in your Android studio project, and the so library file is included in the module, for example:
Then you have to pay attention, if your phone is arm64 architecture then according to the above knowledge we will know, the phone automatically will go to find arm64-v8a this folder under so file, can't find the "folder" to find the Armeabi folder under so file execution, Then according to the above figure, the phone will not find the folder, and finally chose to find the Armeabi folder, very good not wrong.
However, if there is now a x86_64 architecture of the mobile phone then according to the previous knowledge, the phone once found x86_64 This folder will not go to find other folders, identified the folder so file execution, Then you in the operation of the app to point to or trigger the need to use the second module in the so file, we will find that there is no second module of so file in this folder, then unfortunately this will be an error, the report is not found so file " Java.lang.UnsatisfiedLinkError:dalvik.system.PathClassLoader couldn ' t find ' (some). So " now you should understand what the reason is, Clearly I have so file will be what will prompt to find it? That's the reason.
If you understand here, maybe some students are very calm copy of the second module in the x86 folder and then change the name into a x86_64, thought this is OK, can be very clear to tell you GG, so will report a mistake is " Java.lang.UnsatisfiedLinkError: 32bit can ' t 64bit " is not able to convert 32-bit files to 64-bit, although the building folder is built, but so file is not a mess. Solution: Go find the 64-bit so file.
Now I hope you can understand a little, thank you for reading, there are mistakes please correct me.
How to query the current phone CPU architecture, so library import project again out of the ordinary?