Proguard的谷歌播放服务的jar [英] Proguard google play services jar

查看:283
本文介绍了Proguard的谷歌播放服务的jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图混淆谷歌发挥服务罐子使用ProGuard。
我试过proguard的配置文件的两个版本。

I'm trying to obfuscate google play services jar with proguard. I tried two versions of the proguard config file.


  1. 首先一个含有

  1. First one contains

-keep class ** {
    public protected *;
}


和罐子保持不混乱。它看起来不错。

And the jar stays not obfuscated. It looks ok.

第二个包含

-keep class com.** {
    public protected *;
}


和ProGuard的删除everithing。我得到一个错误:

And proguard deletes everithing. I get an error:

    Error: The output jar is empty. Did you specify the proper '-keep' options?

为什么是空的,作为主要的谷歌播放服务包是com.google.android.gms?

Why is it empty, as the main google play services package is com.google.android.gms?

推荐答案

以下ProGuard的配置缩小了谷歌Play服务的罐子,没有优化或模糊,只保留广告相关的API:

The following ProGuard configuration shrinks the Google Play Services jar, without optimization or obfuscation, keeping only the ads-related API:

-injars  android-sdk/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar
-outjars google-play-services-ads.jar

-libraryjars android-sdk/extras/android/support/v4/android-support-v4.jar
-libraryjars android-sdk/platforms/android-20/android.jar

-verbose
-forceprocessing
-dontoptimize
-dontobfuscate
-dontwarn com.google.**.R
-dontwarn com.google.**.R$*
-dontnote

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

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

-keep class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
    java.lang.String NULL;
}

它减少了原来的罐子从2819类409类(2.7M至476K)。我没有测试过,结果呢。如果任何移除类由反射访问,它们必须保持在配置以及

It reduces the original jar from 2819 classes to 409 classes (2.7M to 476K). I haven't tested the result yet. If any removed classes are accessed by reflection, they need to be kept in the configuration as well.

这篇关于Proguard的谷歌播放服务的jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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