gpt4 book ai didi

java - ProGuard:警告:org.apache.commons.beanutils.BeanMap$2:找不到父类(super class)或接口(interface) org.apache.commons.collections.Transformer

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:16:29 25 4
gpt4 key购买 nike

我在 Android 应用程序上使用 Proguard 时遇到以下错误。

ProGuard: [sand] Warning: org.apache.commons.beanutils.BeanMap$2: can't find superclass or interface org.apache.commons.collections.Transformer
ProGuard: [sand] Warning: org.apache.commons.beanutils.BeanMap$3: can't find superclass or interface org.apache.commons.collections.Transformer
ProGuard: [sand] Warning: org.apache.commons.beanutils.BeanMap$4: can't find superclass or interface org.apache.commons.collections.Transformer
ProGuard: [sand] Warning: org.apache.commons.beanutils.BeanMap$5: can't find superclass or interface org.apache.commons.collections.Transformer
ProGuard: [sand] Warning: org.apache.commons.beanutils.BeanMap$6: can't find superclass or interface org.apache.commons.collections.Transformer
ProGuard: [sand] Warning: org.apache.commons.beanutils.BeanMap$7: can't find superclass or interface org.apache.commons.collections.Transformer
ProGuard: [sand] Warning: org.apache.commons.beanutils.BeanMap$8: can't find superclass or interface org.apache.commons.collections.Transformer
ProGuard: [sand] Warning: org.apache.commons.beanutils.BeanMap$9: can't find superclass or interface org.apache.commons.collections.Transformer
ProGuard: [sand] Warning: org.apache.commons.beanutils.BeanMap$Entry: can't find superclass or interface org.apache.commons.collections.keyvalue.AbstractMapEntry
ProGuard: [sand] Warning: org.apache.commons.beanutils.BeanPredicate: can't find superclass or interface org.apache.commons.collections.Predicate
ProGuard: [sand] Warning: org.apache.commons.beanutils.BeanPropertyValueChangeClosure: can't find superclass or interface org.apache.commons.collections.Closure
ProGuard: [sand] Warning: org.apache.commons.beanutils.BeanPropertyValueEqualsPredicate: can't find superclass or interface org.apache.commons.collections.Predicate
ProGuard: [sand] Warning: org.apache.commons.beanutils.BeanToPropertyValueTransformer: can't find superclass or interface org.apache.commons.collections.Transformer
ProGuard: [sand] Warning: org.apache.commons.beanutils.MappedPropertyDescriptor: can't find superclass or interface java.beans.PropertyDescriptor
ProGuard: [sand] Warning: org.apache.commons.logging.impl.ServletContextCleaner: can't find superclass or interface javax.servlet.ServletContextListener
ProGuard: [sand] Warning: roboguice.activity.RoboMapActivity: can't find superclass or interface com.google.android.maps.MapActivity
ProGuard: [sand] Warning: roboguice.test.shadow.ShadowFragmentActivity: can't find superclass or interface com.xtremelabs.robolectric.shadows.ShadowActivity
ProGuard: [sand] Warning: library class org.apache.http.auth.AuthenticationException extends or implements program class org.apache.http.ProtocolException
ProGuard: [sand] Warning: library class org.apache.http.auth.MalformedChallengeException extends or implements program class org.apache.http.ProtocolException
ProGuard: [sand] Warning: library class org.apache.http.auth.params.AuthParamBean extends or implements program class org.apache.http.params.HttpAbstractParamBean

... keeps going till 743 errors (warnings)

我已经尝试了几种方法来防止这种情况发生(-dontskipnonpubliclibraryclassmembers、-keep、-dontwarn、-ignorewarnings)但都没有成功。也许我没有正确使用这些选项。我正在使用 IntelliJ 并以 android-19 (Android 4.4.2) 为目标。

该应用程序使用一些第 3 方库构建:一些包含在 libs 文件夹中,另一些通过 Maven pom.xml 包含。我怀疑通过 pom.xml 包含的库未包含在 -libraryjars 选项中。

我的 project.properties 看起来像这样:

# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
proguard.config=${sdk.dir}/tools/proguard/proguard-android-optimize.txt:proguard-project.txt

# Project target.
target=android-19

我的 proguard-project.txt 看起来像这样:

-dontskipnonpubliclibraryclassmembers

# Libraries
-dontwarn org.apache.**

-keep class android.support.v4.app.** { *; }
-keep interface android.support.v4.app.** { *; }

# WebView with JS: specify the fully qualified class name to the JavaScript interface class:
-keepclassmembers class fqcn.of.javascript.interface.for.webview {
public *;
}

# Database model
-keep class com.mycompany.model.db.**
-keepclassmembers class com.mycompany.model.db.** { *; }

# Project target.
target=android-19

知道为什么会这样吗?

最佳答案

我解决了这个问题。这是由我的 IntelliJ 安装中的配置问题引起的:

项目右键->打开模块设置->Facets选项->编译器选项卡:

  1. 确保 Proguard 已启用
  2. 确保配置文件路径应显示:
    • 我们项目中的 proguard-project.txt 文件
    • 来自 SDK 的 proguard-android.txt。

在我的例子中,它只显示了来自 SDK 的那个,所以我对我的项目中的文件所做的更改没有被考虑在内。

此更改后,我可以使用 Proguard 文档中显示的 Proguard 选项并修复这些警告。

文件 project.properties 由 IntelliJ 自动生成,不应手动修改。即使此文件显示它正在使用这两个文件进行配置,也不一定是真的,请查看“设置”对话框。

关于java - ProGuard:警告:org.apache.commons.beanutils.BeanMap$2:找不到父类(super class)或接口(interface) org.apache.commons.collections.Transformer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21586152/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com