生成 apk 时包含第 3 方 android 库的哪一部分?

What portion of 3rd party android library is included when generating apk?

我在我的 Android 应用程序中使用许多第 3 方库,如 AndEngine、ButterKnife、Parse、Picasa 等。

这是否意味着我必须将所有这些都包含到我的 APK 中? 例如,我只使用 Picasa 库中的一种静态方法来加载图片:

Picasa.load(image, this, null, null);

但是我仍然需要将整个 jar 文件作为支持的库添加到我的 Eclipse IDE。

生成 APK 时,它是否以某种方式 catch/include 仅包含第 3 方库中的特定方法,还是包含整个库?

我遇到了同样的问题。我不知道这是不是一个好的选择。我从库源代码中获取代码,无论我需要什么相关方法,class 和监听器。然后我添加到我的项目中。这就对了。我没有添加整个罐子。但我不知道你的情况,是否有可能获得源代码。

我认为 Proguard 就是您要找的:

http://developer.android.com/tools/help/proguard.html

The ProGuard tool shrinks, optimizes, and obfuscates your code by removing unused code and renaming classes, fields, and methods with semantically obscure names. The result is a smaller sized .apk file that is more difficult to reverse engineer.

确保在开始使用后进行彻底的测试,因为它有时会过于激进。