简体   繁体   English

如何强制Android应用程序使用32位或64位库

[英]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>

  1. 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

  2. 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中运行:

    • To run in 32 bit mode, because only 32 bit native libs will be installed 要在32位模式下运行,因为只安装32位本机库

    adb shell install --abi armeabi-v7a <path to your apk>

    • To run in 64 bit mode, because only 64 bit native libs will be installed 要在64位模式下运行,因为只安装64位本机库

    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.

相关问题 在 64 位 android 上使用 32 位 jni 库 - Use 32-bit jni libraries on 64-bit android 如何在64位Android设备上使用32位本机库 - How to use 32-bit native libraries on 64-bit Android device 使用 64 位或 32 位版本的 Android Studio 时,Gradle 卡在“build”或“assembleDebug” - Gradle gets stuck at either 'build' or 'assembleDebug' when using the 64bit or 32bit version of Android Studio 64位android,32位应用程序,32位本机库 - 64 bit android, 32 bit application with 32 bit native library &#39;armeabi&#39;是32位还是64位? - Is 'armeabi' 32bit or 64bit? 确保gradle依赖项在应用包中包括32位和64位库 - Make sure a gradle dependency includes 32bit and 64bit libraries in app bundles 带有AArch64和32位应用程序的Android内核 - Android kernel with AArch64 and 32bit apps 您如何检查 Delphi Android 10.3.3 是在 64 位还是 32 位上运行? - How do you check if your running in either 64 bit or 32 bit for Delphi Android 10.3.3? 如何在32位系统上继续开发Android Studio x64项目? - How to continue development of an Android Studio x64 project on a 32bit system? 我可以使用32位操作系统虚拟化,但不能使用Android Studio - I can use 32bit OS virtualization but not Android Studio
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM