[英]How to force Android application to use either 32bit or 64 bit libraries
On a Android device with 64bit ARM, would have two variants of many libraries, 32bit and 64 bit, and their performance could be different. 在具有64位ARM的Android设备上,将有两个版本的库,32位和64位,它们的性能可能会有所不同。 I want to know if there is a way to force the application to use either 32bit or 64bit libraries.
我想知道是否有办法强制应用程序使用32位或64位库。
ABI can be specified when the apk is installed. 安装apk时可以指定ABI。
adb install --abi <path to apk>
In case ARM device, 在ARM设备的情况下,
To run in 32 bit mode install using, 要在32位模式下运行安装使用,
adb install --abi armeabi-v7a <path to apk>
To run in 64 bit mode install using, 要在64位模式下运行安装使用,
adb install --abi arm64-v8a <path to apk>
If your apk is written in pure java (without jni), on 64-bit-primiary/32-bit-secondary Android OS, your app will always run in 64 bit mode by default, but if you want your app to run in 32 bit mode, you can create a dummy *.so
file and put it under <your apk name>/libs/armeabi/
to force AndroidRuntime to create a 32 bit VM for your app 如果您的apk是用纯java(没有jni)编写的,那么在64位 - 原始/ 32位辅助Android操作系统上,默认情况下,您的应用程序将始终以64位模式运行,但如果您希望应用程序在32位运行位模式,您可以创建一个虚拟
*.so
文件并将其放在<your apk name>/libs/armeabi/
以强制AndroidRuntime为您的应用创建一个32位VM
If some function of your apk is written in jni (there's any *.so
file in <your apk name>/libs/
folder), you can use following command to make it run in 64 or 32 bit VM: 如果您的apk的某些功能是用jni编写的(
<your apk name>/libs/
文件夹中有任何*.so
文件),您可以使用以下命令使其在64或32位VM中运行:
adb shell install --abi armeabi-v7a <path to your apk>
adb shell install --abi arm64-v8a <path to your apk>
https://source.android.com/source/64-bit-builds.html https://source.android.com/source/64-bit-builds.html
Try this in you Android.mk
在
Android.mk
试试这个
LOCAL_MULTILIB := 32 // or 64
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.