我的APK大小增加谷歌播放服务(AdMob的)后,从65千字节提高到8.8兆字节字节、我的、提高到、大小

2023-09-08 16:00:55 作者:北慕城南

我有一个小的应用程序安装apk文件时,只有富人65KB的大小。现在,我需要使用的AdMob上的应用程序,并添加谷歌播放服务lib目录后,现在已经安装在我的应用程序富人8.8兆字节大小的!!!!!!!这非常令人沮丧...

I have a small app that only haves a size of 65kb when apk is installed. Now i need to use admob on the app, and after adding google play services lib, now my app haves 8.8 megabytes of size when installed!!!!!!! this very frustrating...

这又如何避免?我想,以减少大小的APK

我使用ProGuard的这个配置,以避免谷歌播放服务的错误时,产生一个释放签署APK:

i am using proguard with this config to avoid google play services errors when generating a release signed apk:

-dontwarn com.google.android.gms。**

-dontwarn com.google.android.gms.**

感谢

推荐答案

使用Android的工作室,你可以采取的分拆谷歌播放服务库,确保你只包括谷歌播放必要的服务为你需要的部分。你的情况,你可以使用

Using Android Studio, you can take advantage of the split Google Play Services libraries, ensuring you only include the part of Google Play Services necessary for what you need. In your case, you could use

compile 'com.google.android.gms:play-services-ads:6.5.87'

而不是完整的玩-服务相关性应该大大减少你的APK大小。

Instead of the full play-services dependency which should reduce your APK size tremendously.

使用 ProGuard的和资源萎缩允许你删除未使用的code和资源,从您的应用程序,甚至进一步降低了图书馆的使用只有最低限度的大小。

Using ProGuard and resource shrinking allows you to remove unused code and resources from your application, even further reducing the size of libraries you use to only the bare minimum.

 
精彩推荐
图片推荐