games_services icon indicating copy to clipboard operation
games_services copied to clipboard

Achievements.loadAchievements weird

Open cenyG opened this issue 2 years ago • 1 comments

Achievements.loadAchievements() not works when in release build, but works in debug build.

Other methods GamesServices.signIn(), GamesServices.getPlayerName(), GamesServices.getPlayerScore(...) work for both. So no idea what's going on.

I think it's for any Android, but I tested on Android 12, flutter:3.3.3

cenyG avatar Oct 23 '22 21:10 cenyG

I/flutter (13329): type 'Null' is not a subtype of type 'String' I/flutter (13329): #0 new AchievementItemData.fromJson (package:games_services/src/models/achievement_item_data.dart:38) I/flutter (13329): #1 Achievements.loadAchievements. (package:games_services/src/achievements.dart:20) I/flutter (13329): #2 MappedListIterable.elementAt (dart:_internal/iterable.dart:413) I/flutter (13329): #3 ListIterator.moveNext (dart:_internal/iterable.dart:342) I/flutter (13329): #4 new _GrowableList._ofEfficientLengthIterable (dart:core-patch/growable_array.dart:189) I/flutter (13329): #5 new _GrowableList.of (dart:core-patch/growable_array.dart:150) I/flutter (13329): #6 new List.of (dart:core-patch/array_patch.dart:51) I/flutter (13329): #7 Iterable.toList (dart:core/iterable.dart:470) I/flutter (13329): #8 Achievements.loadAchievements (package:games_services/src/achievements.dart:20) I/flutter (13329): I/flutter (13329): #9 UserInfoProvider.init (package:coutries_quiz/providers/user_info_provider.dart:31)

cenyG avatar Oct 23 '22 22:10 cenyG

This is due to code obfuscation of our serialized model classes in the release build. As a quick temporary fix, exclude the model classes from obfuscation by adding the following line to your proguard rules:

-keep class com.abedalkareem.games_services.models.** { <fields>; }

However, this should be handled by the package. I will submit a pull request shortly to fix this.

theLee3 avatar Oct 26 '22 20:10 theLee3

@Abedalkareem make a new package release, please. You made a lot of useful changes in develop branch

booooohdan avatar Mar 06 '23 02:03 booooohdan

@booooohdan

A new version released.

3.0.1

Abedalkareem avatar Mar 06 '23 02:03 Abedalkareem