I'm experiencing strange errors when using the Google Play Savegames
and Android flavors
.
For testing my game, I have two different flavors
, dev
for testing and release
for publishing.
I'm using Google Play savegames
for both flavors with the same google account. It seems to happen that whenever I push the savegame from one of the versions into the cloud, the other version can't find its savegame any more.
Could there be some kind of conflict by enabling savegame for two flavors
which could result in the loss of my savegame? Shouldn't this be saved as two different games in the cloud if they have diverging package names (com.company.mygame and com.company.mygame.dev) or how does Google Play Games
handle this?
I solved the issue myself, it was a problem with Proguard
. Proguard
renamed the names of my enums which are part of my savegame data, even though the savegamedata itself was excluded from obfuscation. The exclusion worked well for all variable names in the savegame data, but failed for the enum names.
These lines added to the Proguard
rules fixed the problem:
# Application classes that will be serialized/deserialized over JSON, keepclassmembers
-keepclassmembers class com.mycompany.mygame.Utility.SaveGameData** { *; }
# all my enums that were renamed
-keep public enum com.mycompany.mygame.Entities.Player$** {
**[] $VALUES;
public *;
}
-keep public enum com.mycompany.mygame.Entities.Enemy$** {
**[] $VALUES;
public *;
}
-keep public enum com.mycompany.mygame.Entities.Quest$** {
**[] $VALUES;
public *;
}
-keep public enum com.mycompany.mygame.Entities.Room$** {
**[] $VALUES;
public *;
}