简体   繁体   English

在 Android APK 文件上处理手机架构和处理器类型

[英]Dealing with phone architectures and processor types on Android APK file

I've generated a release apk of my Android project in order to do some internal testing via the Developer Console.我已经为我的 Android 项目生成了一个发布 apk,以便通过开发者控制台进行一些内部测试。

Upon generating it, I clicked to analyze the APK file.生成它后,我单击以分析 APK 文件。 From the picture I see most of my APk allocations go to libraries and assets.从图片中,我看到我的大部分 Apk 分配 go 到库和资产。

I'm focusing on the architectures of ARM X86 and X64.我专注于 ARM X86 和 X64 的架构。 I believe they are processor speeds on phones and upon the APK being installed on a phone the Play Store will determine the phones processor and architectures and then download my APK based on that scenario.我相信它们是手机上的处理器速度,并且在手机上安装 APK 后,Play 商店将确定手机处理器和架构,然后根据这种情况下载我的 APK。

My question is that with Android migrating to 64 bit architecture apps can't I get rid of the ARM architectures that aren't 64 bit based.我的问题是,随着 Android 迁移到 64 位架构应用程序,我不能摆脱不基于 64 位的 ARM 架构。

I'm unsure of what do do and would like to get rid of these extra architectures if possible to reduce APK size.我不确定做什么,如果可能的话,我想摆脱这些额外的架构以减少 APK 大小。

Please see the picture provided请查看提供的图片

在此处输入图像描述

Today, the vast majority of Android devices today are arm.今天,绝大多数 Android 器件是 arm。 The Device Catalog on the Play Console reports 98% of devices supported by Play are running on ARM. Play 控制台上的设备目录报告说,Play 支持的 98% 的设备都在 ARM 上运行。 Although this number does not take into account devices not supported by Play or the number of users on each device, it still gives you an idea of the proportions.虽然这个数字没有考虑 Play 不支持的设备或每台设备上的用户数量,但它仍然可以让您了解比例。

That being said, regardless of the architectures you choose to support, when publishing to Play, you should always add support for 64 bits of that architecture.话虽如此,无论您选择支持哪种架构,在发布到 Play 时,您都应该始终添加对该架构的 64 位的支持。 For example, if you want to support arm, you must have the libraries for arm64-v8a and if you want to support x86, you must have the libraries for x86_64 .例如,如果要支持 arm,则必须具有arm64-v8a的库,如果要支持 x86,则必须具有x86_64的库。

However, to reduce APK size, there is now a better way: publishing an Android App Bundle .但是,为了减小 APK 大小,现在有更好的方法:发布Android App Bundle Play introduced this new publishing format to solve that exact problem: you publish a single App Bundle to Play, and Play takes care of generating the APKs optimized for each device, containing only the files needed for their device architecture, screen density and language (customizable). Play 引入了这种新的发布格式来解决这个确切的问题:您将单个 App Bundle 发布到 Play,Play 负责生成针对每个设备优化的 APK,仅包含其设备架构、屏幕密度和语言所需的文件(可自定义)。

All it takes is to enroll in Play App Signing in the Play Console (so that Play can sign the APKs it generates on your behalf), and select "Build Android App Bundle" in Studio instead of "Build APKs".只需在 Play Console 中注册Play App Signing (以便 Play 可以为您生成的 APK 签名),并在 Studio 中注册 select “Build Android App Bundle”而不是“Build APKs”。 -- If you use Gradle, gradlew bundleRelease instead of gradlew assembleRelease . -- 如果您使用 Gradle,请使用gradlew bundleRelease而不是gradlew assembleRelease

Hope that helps,希望有帮助,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM