简体   繁体   English

Android减少APK大小,针对不同架构的单独APK

[英]Android-Reduce APK size, separate APKs for different architectures

I am using native libraries in my Android application. 我在Android应用程序中使用本机库。 Recently, I got a notification from Google to conform to the new requirement asking to provide support for 64bit architecture as well. 最近,我收到Google的通知,要求遵守新要求,并要求它也支持64位体系结构。 My current architecture is armeabi-v7a and I have built my libraries for arm64-v8a and packaged them inside my APK under "libs" folder. 我当前的体系结构是armeabi-v7a,我已经为arm64-v8a构建了我的库,并将它们打包在APK中的“ libs”文件夹下。 Google Play is accepting my APK but packaging everything into one APK has almost doubled the size of my APK. Google Play接受我的APK,但将所有内容打包成一个APK几乎使我的APK大小增加了一倍。 I was just wondering if I build separate APKs for each architecture and publish them to Google Play will it work? 我只是想知道是否可以为每种架构构建单独的APK并将其发布到Google Play上吗? I mean users with 64-bit devices get 64-bit APK and those with 32 bit get the other one? 我的意思是,使用64位设备的用户可以获得64位APK,而拥有32位设备的用户可以获得另一个APK?

看起来您必须使用应用程序捆绑包

You can build one APK per ABI, but this is a complicated maintenance which in particular requires diligence when assigning versionCode to each APK. 您可以为每个ABI构建一个APK,但这是一项复杂的维护,在将versionCode分配给每个APK时尤其需要勤奋。 This is known as Multi APK and is now discouraged in favour of the Android App Bundle which is a single artifact bundling all the files and leaves Play responsible for the generation of the final APKs to users, which it does in a clever way, serving to each device only the files it needs. 这被称为Multi APK ,现在不鼓励使用Android App Bundle ,后者是将所有文件捆绑在一起的单一工件,而Play则负责以最终方式将最终的APK生成给用户,它以一种巧妙的方式完成了工作,每个设备仅需要它的文件。

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

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