1

I have a game which has 4 different flavors(DemoARM, DemoX86, FullARM, FullX86), and the standard two variants (debug/release).

The game uses Google Play sign-in and realtime multiplayer services.

In the Google Play Developers Console, I have 3 apps linked to the game; Debug, Demo Release and Full Release. The debug app is signed with the debug certificate and therefore requires a different OAUTH app ID.

I originally thought of getting around this problem by injecting the resources (doesn't work with hard-coded values) into the manifest using gradle... so I had my manifest looking like this

        <meta-data
        android:name="com.google.android.gms.games.APP_ID"
        android:value="${gmsID}" />
        <meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />

And my build.gradle looked like this

    defaultConfig {
    applicationId "xxx"
    manifestPlaceholders = [ gmsID:"@string/google_app_id_debug"]
    minSdkVersion 17
    targetSdkVersion 17
    versionCode 1
    versionName 'Alpha 1'
}
buildTypes {
    release {
        minifyEnabled false
        manifestPlaceholders = [ gmsID:"@string/google_app_id_release"]
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
}

This worked in that it generated a manifest which linked to the correct resource. But it seems like Google Services are hard-coded to want "app_id" as the resource name, so when I try and sign in with the built application I get a misconfigured message...

  • W/GameHelper: **** APP NOT CORRECTLY CONFIGURED TO USE GOOGLE PLAY GAME SERVICES
  • W/GameHelper: **** This is usually caused by one of these reasons:
  • W/GameHelper: **** (1) Your package name and certificate fingerprint do not match
  • W/GameHelper: **** the client ID you registered in Developer Console.
  • W/GameHelper: **** (2) Your App ID was incorrectly entered.
  • W/GameHelper: **** (3) Your game settings have not been published and you are
  • W/GameHelper: **** trying to log in with an account that is not listed as
  • W/GameHelper: **** a test account.
  • W/GameHelper: ****
  • W/GameHelper: **** To help you debug, here is the information about this app
  • W/GameHelper: **** Package name : com.sakadiwaa.goodtimeswithguns
  • W/GameHelper: **** Cert SHA1 fingerprint: E7:B5:50:13:B8:03:D9:41:BD:22:67:D9:67:8E:3B:20:4E:85:67:60
  • W/ResourceType: No package identifier when getting value for resource number 0x00000000
  • W/System.err: android.content.res.Resources$NotFoundException: String resource ID #0x0
  • W/System.err: at android.content.res.Resources.getText(Resources.java:322)
  • W/System.err: at android.content.res.Resources.getString(Resources.java:420)
  • W/System.err: at com.google.example.games.basegameutils.GameHelperUtils.getAppIdFromResource(GameHelperUtils.java:125)
  • W/System.err: at com.google.example.games.basegameutils.GameHelperUtils.printMisconfiguredDebugInfo(GameHelperUtils.java:109)
LairdPleng
  • 948
  • 3
  • 9
  • 28
  • maybe this is what you are looking for: http://stackoverflow.com/questions/17197636/is-it-possible-to-declare-a-variable-in-gradle-usable-in-java – Rich Feb 04 '16 at 12:41
  • see "code path per flavor" in http://blog.robustastudio.com/mobile-development/android/building-multiple-editions-of-android-app-gradle/ – Robert Rowntree Feb 04 '16 at 12:47

0 Answers0