【发布时间】:2014-12-24 13:03:03
【问题描述】:
问题描述
块模板(https://code.google.com/p/chunk-templates/) 功能在我的调试版本中正常工作。 如果我使用相同的代码进行发布构建,它就会停止工作。如果我在我的发布版本中禁用 proguard,一切都会再次运行。所以我确信它的 proguard 在优化过程中从库中删除了太多。
当我进行第一次发布构建时,有一些关于块模板代码的错误消息。 使用以下 progurad 语句能够生成发布版本 (-dontwarn com.x5.**)。经过一些测试,我发现块模板功能不起作用。
我尝试过的语句(来自 proguard 配置)
- libraryjars /home/ydoganc/projects/contract_info/libs/chunk_2.4/chunk_template_2.4.jar
- dontwarn com.x5.** #does 编译没有错误但无法正常工作
- 保留类 net.minidev.json.** {*;}
- 保留类 com.x5.template.** { *; }
- 保留类 net.minidev.** { *; }
有没有办法防止 proguard 处理库 jar?看起来proguard不是 做配置文件告诉它做的事情。
proguard的错误信息(禁用-dontwarn com.x5.**...语句后):
[2014-10-28 23:33:32 - ContractInfoListActivity] Proguard 返回错误代码 1。请参阅控制台 [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.template.MacroTag:找不到引用的类 net.minidev.json.JSONValue [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.template.MacroTag:找不到引用的类 net.minidev.json.JSONValue [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.template.MacroTag:找不到引用的类 net.minidev.json.JSONArray [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.template.MacroTag:找不到引用的类 net.minidev.json.parser.ParseException [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.template.MacroTag:找不到引用的类 net.minidev.json.parser.JSONParser [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.template.MacroTag:找不到引用的类 net.minidev.json.parser.JSONParser [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.template.MacroTag:找不到引用的类 net.minidev.json.parser.ContainerFactory [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.template.MacroTag:找不到引用的类 net.minidev.json.parser.ContainerFactory [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.template.MacroTag:找不到引用的类 net.minidev.json.parser.JSONParser [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.template.filters.Base64DecodeFilter:找不到引用的类 sun.misc.BASE64Decoder [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.template.filters.Base64DecodeFilter:找不到引用的类 sun.misc.BASE64Decoder [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.template.filters.Base64DecodeFilter:找不到引用的类 sun.misc.BASE64Decoder [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.template.filters.Base64EncodeFilter:找不到引用的类 sun.misc.BASE64Encoder [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.template.filters.Base64EncodeFilter:找不到引用的类 sun.misc.BASE64Encoder [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.template.filters.Base64EncodeFilter:找不到引用的类 sun.misc.BASE64Encoder [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.template.filters.Calc:找不到引用的类 org.cheffo.jeplite.JEP [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.template.filters.Calc:找不到引用的类 org.cheffo.jeplite.JEP [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.template.filters.Calc:找不到引用的类 org.cheffo.jeplite.JEP [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.template.filters.Calc:找不到引用的类 org.cheffo.jeplite.JEP [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.template.filters.Calc:找不到引用的类 org.cheffo.jeplite.JEP [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.template.filters.Calc:找不到引用的类 org.cheffo.jeplite.JEP [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.template.filters.Calc:找不到引用的类 org.cheffo.jeplite.JEP [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.template.filters.Calc:找不到引用的类 org.cheffo.jeplite.ParseException [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.template.filters.Calc:找不到引用的类 org.cheffo.jeplite.ParseException [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.template.filters.Calc:找不到引用的类 org.cheffo.jeplite.ParseException [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.template.filters.Calc:找不到引用的类 org.cheffo.jeplite.JEP [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.template.filters.Calc:找不到引用的类 org.cheffo.jeplite.ParseException [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.util.ObjectDataMap$MadRobotIntrospector:找不到引用的类 com.madrobot.beans.PropertyDescriptor [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.util.ObjectDataMap$MadRobotIntrospector:找不到引用的类 com.madrobot.beans.Introspector [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.util.ObjectDataMap$MadRobotIntrospector:找不到引用的类 com.madrobot.beans.Introspector [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.util.ObjectDataMap$MadRobotIntrospector:找不到引用的类 com.madrobot.beans.BeanInfo [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.util.ObjectDataMap$MadRobotIntrospector:找不到引用的类 com.madrobot.beans.BeanInfo [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.util.ObjectDataMap$MadRobotIntrospector:找不到引用的类 com.madrobot.beans.PropertyDescriptor [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.util.ObjectDataMap$MadRobotIntrospector:找不到引用的类 com.madrobot.beans.PropertyDescriptor [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.util.ObjectDataMap$MadRobotIntrospector:找不到引用的类 com.madrobot.beans.PropertyDescriptor [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.util.ObjectDataMap$MadRobotIntrospector:找不到引用的类 com.madrobot.beans.PropertyDescriptor [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.util.ObjectDataMap$MadRobotIntrospector:找不到引用的类 com.madrobot.beans.IntrospectionException [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.util.ObjectDataMap$MadRobotIntrospector:找不到引用的类 com.madrobot.beans.PropertyDescriptor [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.util.ObjectDataMap$MadRobotIntrospector:找不到引用的类 com.madrobot.beans.BeanInfo [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.util.ObjectDataMap$MadRobotIntrospector:找不到引用的类 com.madrobot.beans.IntrospectionException [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.util.ObjectDataMap$MadRobotIntrospector:找不到引用的类 com.madrobot.beans.PropertyDescriptor [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.util.ObjectDataMap$StandardIntrospector:找不到引用的类 java.beans.PropertyDescriptor [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.util.ObjectDataMap$StandardIntrospector:找不到引用的类 java.beans.Introspector [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.util.ObjectDataMap$StandardIntrospector:找不到引用的类 java.beans.Introspector [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.util.ObjectDataMap$StandardIntrospector:找不到引用的类 java.beans.BeanInfo [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.util.ObjectDataMap$StandardIntrospector:找不到引用的类 java.beans.BeanInfo [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.util.ObjectDataMap$StandardIntrospector:找不到引用的类 java.beans.PropertyDescriptor [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.util.ObjectDataMap$StandardIntrospector:找不到引用的类 java.beans.PropertyDescriptor [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.util.ObjectDataMap$StandardIntrospector:找不到引用的类 java.beans.PropertyDescriptor [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.util.ObjectDataMap$StandardIntrospector:找不到引用的类 java.beans.PropertyDescriptor [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.util.ObjectDataMap$StandardIntrospector:找不到引用的类 java.beans.IntrospectionException [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.util.ObjectDataMap$StandardIntrospector:找不到引用的类 java.beans.PropertyDescriptor [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.util.ObjectDataMap$StandardIntrospector:找不到引用的类 java.beans.BeanInfo [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.util.ObjectDataMap$StandardIntrospector:找不到引用的类 java.beans.IntrospectionException [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:com.x5.util.ObjectDataMap$StandardIntrospector:找不到引用的类 java.beans.PropertyDescriptor [2014-10-28 23:33:32 - ContractInfoListActivity] 您应该检查是否需要指定其他程序 jar。 [2014-10-28 23:33:32 - ContractInfoListActivity] 警告:有 55 个未解析的类或接口引用。 [2014-10-28 23:33:32 - ContractInfoListActivity] 您可能需要指定其他库 jars(使用“-libraryjars”)。 [2014-10-28 23:33:32 - ContractInfoListActivity] java.io.IOException:请先更正上述警告。 [2014-10-28 23:33:32 - ContractInfoListActivity] 在 proguard.Initializer.execute(Initializer.java:321) [2014-10-28 23:33:32 - ContractInfoListActivity] 在 proguard.ProGuard.initialize(ProGuard.java:211) [2014-10-28 23:33:32 - ContractInfoListActivity] 在 proguard.ProGuard.execute(ProGuard.java:86) [2014-10-28 23:33:32 - ContractInfoListActivity] 在 proguard.ProGuard.main(ProGuard.java:492)【问题讨论】:
-
您至少需要
keep class com.x5.util.** { *; }以及其他“保留”行 -
我已经尝试过您的建议,但它不起作用。我创建工作 apk 的唯一方法是禁用 proguard。
-
我将所有库 jar 直接放在 libs/ 文件夹中(而不是在子文件夹中),我的 proguard-project.txt 文件中唯一的东西是
-ignorewarnings我只设置了一个示例项目块和 json-smart 和发布 apk 工作正常。你在用 madrobot 的东西吗? -
构建发布apk后, grep "^com.x5" bin/proguard/mapping.txt 的输出是什么?这可以肯定地告诉我们是否缺少任何重要的课程。请在github.com/tomj74/chunk-templates/issues 打开一个问题并将输出发布到那里。谢谢!
-
@user1069218 您找到解决方案了吗?我正在尝试在启用 proguard 的情况下进行构建(对于这个库 github.com/kexanie/MathView,它也使用块模板)但是在添加了所有上述“保留”行之后的事件,它只是不起作用。
标签: java android template-engine chunk-templates