playgameservices / play-games-plugin-for-unity

Google Play Games plugin for Unity
Other
3.46k stars 967 forks source link

TokenFragment class not found error #2054

Open neurofluid opened 6 years ago

neurofluid commented 6 years ago

I see that this issue continues to rear its ugly head.

What I did:

Follow directions to create and run SmokeTest. When running the compiled app on a Nexus 5X API 27 simulator and pressing 'Authenticate' I get:

12-13 06:34:18.741 16595 16615 W Unity : java.lang.ClassNotFoundException: com.google.games.bridge.TokenFragment 12-13 06:34:18.741 16595 16615 W Unity : at java.lang.Class.classForName(Native Method) 12-13 06:34:18.741 16595 16615 W Unity : at java.lang.Class.forName(Class.java:453) 12-13 06:34:18.741 16595 16615 W Unity : at java.lang.Class.forName(Class.java:378) 12-13 06:34:18.741 16595 16615 W Unity : at com.unity3d.player.UnityPlayer.nativeRender(Native Method) 12-13 06:34:18.741 16595 16615 W Unity : at com.unity3d.player.UnityPlayer.c(Unknown Source:0) 12-13 06:34:18.741 16595 16615 W Unity : at com.unity3d.player.UnityPlayer$c$1.handleMessage(Unknown Source:157) 12-13 06:34:18.741 16595 16615 W Unity : at android.os.Handler.dispatchMessage(Handler.java:102) 12-13 06:34:18.741 16595 16615 W Unity : at android.os.Looper.loop(Looper.java:164) 12-13 06:34:18.741 16595 16615 W Unity : at com.unity3d.player.UnityPlayer$c.run(Unknown Source:20)

Unity 5.6.4p4 64 bit running on OS X 10.13.2

Same behaviour is exhibited in my own game, but I thought I'd eliminate the obvious by trying one of the sample projects first.

Any help would be greatly appreciated.

creutzfeldt0 commented 6 years ago

Same error 0.9.42 Unity 2017.2.0f3, gradlebuild, use proguard

creutzfeldt0 commented 6 years ago

I solved it!!!

If you are using 'Unity 2017','gradle build', add " -keep class com.google.games.* { ; } -keep interface com.google.games.* { ; } " to 'proguard-user.txt' file.

neurofluid commented 6 years ago

Thanks for the comment, @creutzfeldt0 but it didn't work for me.

I'm using 5.6.4p4 and migrating to 2017 isn't an option right now due to time constraints and refactoring that would have to be done. 5.6 doesn't have any option to manipulate the proguard file.

Right now my build process is to export to a gradle project, make some minor changes to the build.gradle file and then create the build.

Adding those changes to the proguard file (that's created in the export process) makes no difference.

The irony is that this whole exercise started due to hitting the 65K DEX limit caused when adding google play games (there are other libraries that contribute to it, but they're much more necessary than Google leaderboards to me). If I remove it, then I can just use Unity's regular build process.

Deepscorn commented 6 years ago

Same problem, but in my case proguard is disabled. How can this be possible? 2018-02-19 18 00 37 log: https://gist.github.com/Deepscorn/7a471d30656024a01092ff8b3d43a463 build.gradle:

buildTypes {
    debug {
        minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt', '../../../AndroidSources/proguard.cfg'
    }
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt', '../../../AndroidSources/proguard.cfg'
    }
}
Deepscorn commented 6 years ago

Resolved our issue - we've lost play-games-plugin-support.aar during git merge

Latheror commented 5 years ago

Struggling with this problem for weeks now... Any advice on what to try ?