我试图用ProGuard混淆我的libgdxJava项目,但是我在某个时候得到了一个关于主题小部件库的错误。这是我的桌面项目(不是Android):
Ignoring unused library classes...
Original number of library classes: 19830
Final number of library classes: 880
Optimizing...
Unexpected error while evaluating instruction:
Class = [de/matthiasmann/twlthemeeditor/datamodel/Include]
Method = [addToXPP(Lde/matthiasmann/twlthemeeditor/datamodel/DomXPPParser;)V]
Instruction = [6] invokevirtual #71
Exception = [java.lang.IllegalArgumentException] (Can't find common super class of [java/lang/Object] (with 0 known super classes) and [de/matthiasmann/twlthemeeditor/datamodel/Include] (with 1 known super classes))
Unexpected error while performing partial evaluation:
Class = [de/matthiasmann/twlthemeeditor/datamodel/Include]
Method = [addToXPP(Lde/matthiasmann/twlthemeeditor/datamodel/DomXPPParser;)V]
Exception = [java.lang.IllegalArgumentException] (Can't find common super class of [java/lang/Object] (with 0 known super classes) and [de/matthiasmann/twlthemeeditor/datamodel/Include] (with 1 known super classes))
java.lang.IllegalArgumentException: Can't find common super class of [java/lang/Object] (with 0 known super classes) and [de/matthiasmann/twlthemeeditor/datamodel/Include] (with 1 known super classes)
at proguard.evaluation.value.ReferenceValue.generalize(ReferenceValue.java:344)
at proguard.evaluation.value.ReferenceValue.generalize(ReferenceValue.java:481)
at proguard.optimize.info.MethodOptimizationInfo.generalizeParameter(MethodOptimizationInfo.java:231)
at proguard.optimize.evaluation.StoringInvocationUnit.generalizeMethodParameterValue(StoringInvocationUnit.java:176)
at proguard.optimize.evaluation.StoringInvocationUnit.setMethodParameterValue(StoringInvocationUnit.java:112)
at proguard.evaluation.BasicInvocationUnit.visitAnyMethodrefConstant(BasicInvocationUnit.java:223)
at proguard.classfile.util.SimplifiedVisitor.visitMethodrefConstant(SimplifiedVisitor.java:204)
at proguard.classfile.constant.MethodrefConstant.accept(MethodrefConstant.java:69)
at proguard.classfile.ProgramClass.constantPoolEntryAccept(ProgramClass.java:453)
at proguard.evaluation.BasicInvocationUnit.invokeMember(BasicInvocationUnit.java:178)
at proguard.evaluation.Processor.visitConstantInstruction(Processor.java:573)
at proguard.classfile.instruction.ConstantInstruction.accept(ConstantInstruction.java:157)
at proguard.optimize.evaluation.PartialEvaluator.evaluateSingleInstructionBlock(PartialEvaluator.java:753)
at proguard.optimize.evaluation.PartialEvaluator.evaluateInstructionBlock(PartialEvaluator.java:587)
at proguard.optimize.evaluation.PartialEvaluator.evaluateInstructionBlockAndExceptionHandlers(PartialEvaluator.java:560)
at proguard.optimize.evaluation.PartialEvaluator.visitCodeAttribute0(PartialEvaluator.java:264)
at proguard.optimize.evaluation.PartialEvaluator.visitCodeAttribute(PartialEvaluator.java:181)
at proguard.classfile.attribute.CodeAttribute.accept(CodeAttribute.java:101)
at proguard.classfile.ProgramMethod.attributesAccept(ProgramMethod.java:79)
at proguard.classfile.attribute.visitor.AllAttributeVisitor.visitProgramMember(AllAttributeVisitor.java:95)
at proguard.classfile.util.SimplifiedVisitor.visitProgramMethod(SimplifiedVisitor.java:91)
at proguard.classfile.ProgramMethod.accept(ProgramMethod.java:71)
at proguard.classfile.ProgramClass.methodsAccept(ProgramClass.java:504)
at proguard.classfile.visitor.AllMethodVisitor.visitProgramClass(AllMethodVisitor.java:47)
at proguard.classfile.ProgramClass.accept(ProgramClass.java:346)
at proguard.classfile.ClassPool.classesAccept(ClassPool.java:125)
at proguard.optimize.Optimizer.execute(Optimizer.java:372)
at proguard.ProGuard.optimize(ProGuard.java:307)
at proguard.ProGuard.execute(ProGuard.java:116)
at proguard.ProGuard.main(ProGuard.java:484)
这是我的ProGuard配置文件的外观:
-injars ../Acast-desktop/bin/Acast.jar(!META-INF/MANIFEST.MF)
-outjars ../Acast-desktop/bin/Acast-guarded.jar
-libraryjars ../Acast/libs/gdx-sources.jar
-libraryjars ../Acast/libs/gdx-controllers-desktop.jar
-libraryjars ../Acast/libs/gdx-controllers-gwt.jar
-libraryjars ../Acast/libs/gdx-controllers-android.jar
-libraryjars ../Acast/libs/gdx-controllers.jar
-libraryjars ../Acast/libs/gdx-controllers-desktop-natives.jar
-libraryjars ../Acast/libs/gdx-tools.jar
-libraryjars ../Acast/libs/gdx.jar
-libraryjars ../Acast/libs/json-simple-1.1.1.jar
-libraryjars ../Acast/libs/acast-network-commons.jar
-libraryjars ../Acast-desktop/libs/gdx-backend-lwjgl.jar
-libraryjars ../Acast-desktop/libs/gdx-backend-lwjgl-sources.jar
-libraryjars ../Acast-desktop/libs/gdx-backend-lwjgl-natives.jar
-libraryjars ../Acast-desktop/libs/gdx-natives.jar
-libraryjars ../Acast-network-commons/libs/kryonet-2.18-all.jar
-libraryjars <java.home>/../jre/lib/rt.jar
-optimizationpasses 1
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-dontshrink
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService
-keep class org.apache.**
-keep class de.matthiasmann.**
-keep class de.matthiasmann.twlthemeeditor.**
-keep class com.jcraft.**
-keep class com.badlogic.**
-keep class com.badlogic.gdx.**
-keep class com.badlogic.gdx.backends.**
-keep class com..badlogic.gdx.controllers.**
-keep class javax.**
-keep class org.lwjgl.**
-keep class org.lwjgl.opengl.**
-keep class com.badlogic.backends.**
-keep class * implements com.badlogic.gdx.utils.Json*
-keep class com.esotericsoftware.**
-keep class com.esotericsoftware.kryo.**
-keep class com.google.**
-keep class java.lang.reflect.**
-dontnote
-dontwarn de.matthiasmann.**
-dontwarn com.esotericsoftware.kryo.**
-dontwarn com.badlogic.gdx.**
-dontwarn org.lwjgl.**
-keepclasseswithmembernames class * {
native <methods>;
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
-keep public class com.pixelonion.acast.Main{
public static void main(java.lang.String[]);
}
我不理解抛出的异常。我是否错过了包括一个图书馆罐?当我删除行“dontwarn de.matthiasmann.*.”从我的proguard配置中,我得到了类似“找不到引用的类de.matthiasmann.twl.Widget”的错误。我明确告诉ProGuard保留libgdx和matthiasmann的类(小部件库:http://twl.l33tlabs.org/)这样它们就不会被混淆(反正它们是开源的)。
我能够解决这个问题:
首先保持队形很重要
-dontwarn de.matthiasmann.**
然后在此处下载官方图书馆:http://twl.l33tlabs.org/dist/TWL.jar
之后,您将库添加到外部库罐中:
-libraryjars ../Project/libs/TWL.jar
就这样。它将正确地混淆和优化代码。我还没有试过运行它,因为我遇到了另一个问题。但至少现在错误已经消失了。
使用安装程序创建新的LibGdx项目后。jar文件。我已经按照说明使用IntelliJ配置我的新应用程序并启动桌面应用程序。但我得到了以下错误: 桌面启动器。爪哇: IDE说“未使用的导入”表明它根本找不到它们。 更新:
问题内容: 我在桌面上遇到LibGDX的问题。尝试启动应用程序时,我始终收到以下错误: 我将以下库添加到我的项目中: gdx.jar gdx-sources.jar gdx-natives.jar gdx-backend-lwjgl.jar gdx-backend-lwjgl-natives.jar 我想念什么吗? 我已经搜索了很多东西,但是我发现的一切都是针对Android的,它告诉我将arm文
我按照IntelliJ安装教程中的描述设置了我的项目,但是我无法启动桌面应用程序。Android应用程序在模拟器和我的S3上启动良好,但桌面中的main无法找到我的类。. 日志: 我正在运行MacOSX10.7.5、苹果的JavaJDK1.6.0_43和IntelliJ12.0.4。我觉得这件事非常简单,我就是找不到问题所在。(别嘲笑我的班名,是给我4岁的女儿的);D
使用JDeveloper 12.1.3.0.0,我创建了一个Java桌面应用程序,它使用Oracle JDBC和BC4J Oracle域库(通过项目属性->库和类路径添加它们)。在JDeveloper中,所有的东西都可以很好地编译和运行,但是我很难部署一个工作的JAR文件。这个JAR文件需要包含库,因为它将直接放置到客户端机器上。 当前失败得尝试:我已在项目属性中创建了部署配置文件.这个概要文件将
我已将支持库从v22.2.1更新到v23.0.0,在构建应用程序(minifyEnabled为true)后,我遇到“AppCompat不支持当前主题功能”异常: 调试应用或禁用前置保护(缩小启用 false)时,不会引发异常。仅当启用了专业警卫时,它才会投掷。 主题: Proguard文件: 我已经尝试了这个问题的答案:升级到AppCompat v22.1.0,现在得到IllegalArgumen
引用 changetheme.nsi 的内容: Name "ChangeStyleXP" OutFile "ChangeStyleXP.exe" !include "FileFunc.nsh" !insertmacro GetFileName !define BM_CLICK 0x00F5 !define WM_CLOSE 0x0010 Section IfFileExists "$WI