如何减少应用程序的大小AdMob的广告后,增加了吗? [英] how to reduce app size increased after admob ads?

查看:119
本文介绍了如何减少应用程序的大小AdMob的广告后,增加了吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

加入谷歌,播放服务,以我的项目之前,它的大小是刚好 900KB 并加入播放服务lib目录后,现在是 4.01MB 。它是可怕的。为3MB的900KB的应用程序的广告实在是太多了。

before adding google-play-services to my project its size was just 900kb and after adding lib of play services it is now 4.01MB. its terrible. for 900kb app ads of 3MB is too much.

帮助我尽快。现在我的应用程序就完成了。

help me as soon as possible. my app is finished now.

我试着阅读的ProGuard ,但无法理解。有人请给我一步一步的教程,以减少应用程序的大小。

I tried reading about proguard but unable to understand. someone please give me step by step tutorial to reduce app size.

推荐答案

您不需要编辑谷歌播放services.jar文件。使用ProGuard的只保留必要的类文件。

You don't need to edit google-play-services.jar file. Use proguard to keep only needed class files.

在你的模块目录中创建proguard.txt文件(如应用程序/),并写在该目录下面几行:

Create proguard.txt file in your module directory (e.g. app/) and write following lines in that directory:

-keep public class com.google.android.gms.ads.** {
    public *;
}

-keep public class com.google.ads.** {
    public *;
}

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

现在写以下在模块的build.gradle文件行(对于如应用程序/ build.gradle):

Now write following lines in your module's build.gradle file (for e.g. app/build.gradle):

...
buildTypes {
    debug {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.txt'
    }
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.txt'
    }
    ...
}
...

同步你的摇篮文件,并建立与放大器;运行你的应用程序。现在,看到你的应用程序的大小不同。

Sync your gradle file and build & run your app. Now see the difference in size of your app.

这篇关于如何减少应用程序的大小AdMob的广告后,增加了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆