proguard Missing type parameter

后端 未结 3 1031
闹比i
闹比i 2020-11-29 03:15

i try obfuscate my code of android app with ProGuard. But after this my app give exception at running:

11-15 01:46:26.818: W/System.err(21810)         


        
3条回答
  •  离开以前
    2020-11-29 03:39

    This issue can be solved by using a different way to create the TypeToken instance (for the parameterized type Map):

    Type collectionType = 
      TypeToken.get(
        $Gson$Types.newParameterizedTypeWithOwner(null,
          Map.class, Integer.class, WatchedEpisodes.class)).getType();
    

    The next version of gson (I assume 2.8), will allow you to type this more easily:

    Type collectionType =
      TypeToken.getParameterized(Map.class,
                                 Integer.class,
                                 WatchedEpisodes.class).getType();
    

提交回复
热议问题