相关疑难解决方法(0)

如何让Proguard忽略外部库?

我想使用Proguard主要是出于混淆的原因.

我的问题是我有三个库,Twitter4J和两个路标库.当我尝试创建签名的APK时,这些库会导致错误.为了克服这个问题,我在proguard.config文件中添加了以下内容......

-dontwarn org.apache.commons.codec.binary.** 
-dontwarn org.slf4j.** 
-dontwarn com.sun.syndication.io.**
-dontwarn com.sun.syndication.feed.synd.*   
Run Code Online (Sandbox Code Playgroud)

虽然这摆脱了控制台中的错误,当我将签名的APK加载到我的手机上时,它立即崩溃了.DDMS说这是由于Twitter4J中没有找到的课程.

摆脱"dontwarns"上述情况并没有帮助.也没有添加dontshrink dontoptimise.

我希望Proguard完全忽略这些库(因为它们无论如何都是开源的).这可能吗?

android proguard android-library

47
推荐指数
2
解决办法
4万
查看次数

Android中的Proguard和反射

我刚刚使用了proguard,但我试图通过反射实例化的类不起作用.

我有一个界面

Algorithm
Run Code Online (Sandbox Code Playgroud)

我通过这样的课程

AlgorithmFactory.SomeClassThatExtendsAlgorithmImpl.class
Run Code Online (Sandbox Code Playgroud)

该类实例化如下

public ArrayList<Algorithm> getAlgorithms(Context cnx) {
ArrayList<Algorithm> list = new ArrayList<Algorithm>();

for(Class<? extends Algorithm> alg: algorithms) {

    try {
        Constructor<? extends Algorithm> c = alg.getConstructor(Context.class);
        list.add(c.newInstance(cnx));
    } catch (IllegalArgumentException e) {
        Log.e(TAG, "IllegalArgumentException", e);
        throw new IllegalStateException("There was a problem creating the Algorithm class");
    } catch (InvocationTargetException e) {
        Log.e(TAG, "InvocationTargetException", e);
        throw new IllegalStateException("There was a problem creating the Algorithm class");
    } catch (InstantiationException e) {
        Log.e(TAG, "InstantiationException", e);
        throw new IllegalStateException("There was a …
Run Code Online (Sandbox Code Playgroud)

java reflection obfuscation android proguard

34
推荐指数
2
解决办法
2万
查看次数