本文介绍了使用安卓Facebook sdk 3.0的proguard错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

警告:我删除了很多旧文字,使问题更加干净。只需检查历史记录即可。

Warning: I removed a lot of "old text" to keep the question more clean. Just check the history if needed.

我正在使用 proguard 来缩小和混淆使用(我使用)。我没有使用JAR文件。相反,我将sdk导入我的工作区,如。

I'm using proguard to both shrink and obfuscate an app that uses the facebook sdk 3.0 (I'm using the sdk-version-3.0.2.b tag). I'm not using a JAR file. Instead, I imported the sdk inside my workspace, as taught by the documentation.

在执行的某个时刻,应用程序加载一个让用户选择他所在的地方。为了编写这个,我完全遵循的专业化。

As you can see, my proguard configuration is a "specialization" of this file.

如果我在 proguard-project.txt 文件中放入 -dontobfuscate 它会工作。但是我不明白的是,保持类com.facebook。** 应该已经阻止与facebook相关的类被模糊。这表明问题与facebook类没有直接关系。

If I put -dontobfuscate in proguard-project.txt file, it will work. But what I don't understand is that the keep class com.facebook.** should already prevent classes related to facebook to be obfuscated. Which suggests that the problem is not directly related to the facebook classes.

,抛出 com.facebook.FacebookGraphObjectException 是:

static <U> U coerceValueToExpectedType(Object value, Class<U> expectedType,
        ParameterizedType expectedTypeAsParameterizedType) {

    // [...]

    } else if (Iterable.class.equals(expectedType) || Collection.class.equals(expectedType)
        || List.class.equals(expectedType) || GraphObjectList.class.equals(expectedType)) {
        if (expectedTypeAsParameterizedType == null) {
            throw new FacebookGraphObjectException("can't infer generic type of: " + expectedType.toString());
        }
    // [...]
}

显然,在发布版本中, expectedTypeAsParameterizedType null 。但是在两个版本(调试和发布)中, expectedType 是一个 com.facebook.model.GraphObjectList 接口。不幸的是,我几乎不了解Java反射概念。

Clearly, expectedTypeAsParameterizedType is null in release build. But in both builds (debug and release) expectedType is a com.facebook.model.GraphObjectList interface. Unfortunately, I don't understand almost nothing about Java reflection concepts.

我如何解决这个问题?

推荐答案

这将解决您的问题,我希望:

This will solve your problem, i hope:

胜利者是...

And the winner is .....

-keepattributes Signature

从Proguard主页:

From Proguard Homepage:

这篇关于使用安卓Facebook sdk 3.0的proguard错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-17 05:25
查看更多