微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android:proguard不删除空文件

如何解决android:proguard不删除空文件

我有一个来自库模块的文件。我没有在此文件调用任何方法。因此,我希望Proguard可以删除文件。但是我仍然在我的apk中看到引用。 该文件是:

public final class DebugUtils {
private DebugUtils(){}

public static void setAcceptSSLConnections()  {
    SSLContext sc = null;
    try {
        sc = SSLContext.getInstance("SSL");
    } catch (NoSuchAlgorithmException e) {
        //This isn't a production error since this
        // code is debug only
        throw new RuntimeException(e);
    }
    TrustManager[] trustAllCerts = new TrustManager[]{ new x509trustmanager() {
        @Override
        public void checkClientTrusted(X509Certificate[] chain,String authType)
                throws CertificateException {}

        @Override
        public void checkServerTrusted(X509Certificate[] chain,String authType)
                throws CertificateException {}

        @Override
        public X509Certificate[] getAcceptedissuers() {
            return null;
        }
    }};
    try {
        sc.init(null,trustAllCerts,new java.security.SecureRandom());
    } catch (KeyManagementException e) {
        //This isn't a production error since this
        // code is debug only
        throw new RuntimeException(e);
    }
    HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());

    // Create all-trusting host name verifier
    HostnameVerifier allHostsValid = new HostnameVerifier() {
        public boolean verify(String hostname,SSLSession session) {
            return true;
        }
    };
    // Install the all-trusting host verifier
    HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);
}

}

usage.txt(由proguard生成输出文件)说: com ..... DebugUtils: 22:61:public static void setAcceptSSLConnections()

但是我仍然在我的apk中看到: DebugUtils 1美元 (米)() (m)避免checkClientTrusted(....) (m)java.security.cert.X%)(Certificate [] getAcceptedissuers()

等...

我是否可以做一些更改,以便Proguard完全删除文件

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。