ProGuard:ClassCastException
ProGuard: ClassCastException
当我混淆我的 Java 代码(在我使用 ProGuard
混淆之前工作正常)时,我变得很烦人 ClassCastException
。
java.lang.ClassCastException: com.google.gson.internal.StringMap cannot be cast to net.minecraft.launcher.profile.Profile
at java.lang.ClassCastException: com.google.gson.internal.StringMap cannot be cast to net.minecraft.launcher.profile.Profile
at net.minecraft.launcher.profile.ProfileManager.getSelectedProfile(SourceFile:117)
at net.minecraft.launcher.g.run(SourceFile:184)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
ClastCastException 错误指向这段代码,这里(粗体行是确切的行):
public Profile getSelectedProfile()
{
if ((this.selectedProfile == null) || (!this.profiles.containsKey(this.selectedProfile))) {
if (this.profiles.get("Default") != null)
{
this.selectedProfile = "Default";
}
else if (this.profiles.size() > 0)
{
this.selectedProfile = ((Profile)this.profiles.values().iterator().next()).getName();
}
else
{
this.selectedProfile = "Default";
this.profiles.put("Default", new Profile(this.selectedProfile));
}
}
*Profile profile = this.profiles.get(this.selectedProfile);*
return profile;
}
整个 Class 文件(未混淆):http://pastebin.com/Jgh4x1SS
RawProfileList
Class 文件(未混淆):http://pastebin.com/vPxFpYfC
ProGuard
版本:5.2.1
配置文件字段声明:
private final Map<String, Profile> profiles = new HashMap<String, Profile>();
你的 类 看起来不错。 ClassCastException
意味着 Gson
不知道一个字段应该被序列化为 Profile
.
确保您的 proguard.cfg
包含所有 these rules。
当我混淆我的 Java 代码(在我使用 ProGuard
混淆之前工作正常)时,我变得很烦人 ClassCastException
。
java.lang.ClassCastException: com.google.gson.internal.StringMap cannot be cast to net.minecraft.launcher.profile.Profile
at java.lang.ClassCastException: com.google.gson.internal.StringMap cannot be cast to net.minecraft.launcher.profile.Profile
at net.minecraft.launcher.profile.ProfileManager.getSelectedProfile(SourceFile:117)
at net.minecraft.launcher.g.run(SourceFile:184)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
ClastCastException 错误指向这段代码,这里(粗体行是确切的行):
public Profile getSelectedProfile()
{
if ((this.selectedProfile == null) || (!this.profiles.containsKey(this.selectedProfile))) {
if (this.profiles.get("Default") != null)
{
this.selectedProfile = "Default";
}
else if (this.profiles.size() > 0)
{
this.selectedProfile = ((Profile)this.profiles.values().iterator().next()).getName();
}
else
{
this.selectedProfile = "Default";
this.profiles.put("Default", new Profile(this.selectedProfile));
}
}
*Profile profile = this.profiles.get(this.selectedProfile);*
return profile;
}
整个 Class 文件(未混淆):http://pastebin.com/Jgh4x1SS
RawProfileList
Class 文件(未混淆):http://pastebin.com/vPxFpYfC
ProGuard
版本:5.2.1
配置文件字段声明:
private final Map<String, Profile> profiles = new HashMap<String, Profile>();
你的 类 看起来不错。 ClassCastException
意味着 Gson
不知道一个字段应该被序列化为 Profile
.
确保您的 proguard.cfg
包含所有 these rules。