Search Unity

Gradle nightmare (appAuthRedirectScheme)

Discussion in 'Android' started by greay, Feb 20, 2020.

  1. greay

    greay

    Joined:
    Mar 23, 2011
    Posts:
    88
    Recently updated our project to 2018.4.17. My partner, on Windows, is able to build the project to Android without issue. I am unable to, however. As far as I can tell, all our project settings should be exactly the same, and we're using the same version of the Android SDK / JDK / NDK.

    This is the error I'm getting:
    I have NO IDEA what this means, or how to fix it. The little bit I've been able to find online about it suggests editing the build.gradle, but we both have "Custom Gradle Template" unchecked, so as far as I'm aware, Unity is auto-generating that for us.

    I don't even really know how to start troubleshooting this, much less what I need to do to fix it. The fact that one of us is able to build fine is also confusing.
     
  2. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    Do you have the same plugins on both machines as well? Maybe you have some authentication plugins added to your machine which causes this issue? Searching for the error results in posts where it seems that modifying gradle template to provide a placeholder substitution value is the solution.
    I've found discussion here https://github.com/openid/AppAuth-Android/issues/128 and here https://stackoverflow.com/questions...ifest-xml-requires-a-placeholder-substitution
     
  3. skullthug

    skullthug

    Joined:
    Oct 16, 2011
    Posts:
    202
    @JuliusM hello, I'm the mentioned partner.
    After some further digging, we discovered something strange.
    I was able to build successfully, but @greay was not, and the key difference was that he had just locally removed the UnityGoogleDrive implementation from our project. I found that if I also removed the UnityGoogleDrive implementation I would now also get the same error. The UGD implementation is fairly isolated and keeps to its own folder fairly well, but now it seems it was, possibly, somehow compensating for this?

    Anyways I dug around a lot for any possible AndroidManifest or gradle conflicts to no avail.
    So I literally just tried utilizing the unity Custom Gradle Template and added the line:
    manifestPlaceholders = ['appAuthRedirectScheme': 'YOURSCHEME']

    to the defaultConfig {} section. I didn't even bother to rename YOURSCHEME, as I don't understand what this is on about.

    After doing that, it builds fine and I'm quite baffled. Even with the dummy name.
    Is there a way to resolve this without having to do this weird custom gradle template hack? I have a bad feeling it easily backfire on us in the future.
     
  4. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    Hello,

    I don't know how UnityGoogleDrive plugin works or how it was integrated in your project, but if this issue is really caused by this plugin (you can double check that with a new empty project, just importing the plugin and then removing it), then the plugin likely has modified (or required you to modify) the manifest file. There must be a "${appAuthRedirectScheme}" variable in one of your manifests (either the main one or one provided by the plugin). This variable in the manifest is replaced by the value specified in your gradle template. If a plugin needs that value, then obviously it will not work. The only question is if this value was added by UnityGoogleDrive plugin or not. If it was added by the UGD plugin and you don't want to use this plugin, you could simply remove that value from your manifest. Then you will not need to specify it in gradle template either. You can read more about variables in the manifest here https://developer.android.com/studio/build/manifest-build-variables
     
  5. skullthug

    skullthug

    Joined:
    Oct 16, 2011
    Posts:
    202
    That's sort of the bonkers thing. I've dug through our AndroidManifest.xml (and any other possible ones that might have been included) and there is no appAuthRedirectScheme variable present anywhere. There's nothing obvious calling to Unity Google Drive at this point either. AFAIK we've removed UGD completely.

    However we have noticed when we removed UGD, that included removing Dependencies.xml (that was in the UGD folder), which I'm guessing might have been what was preventing the error?
    This is the contents of of it, which mentions AppAuth.

    <dependencies>
    <androidPackages>
    <androidPackage spec="net.openid:appauth:0.7.1+" />
    </androidPackages>
    <iosPods>
    <iosPod name="AppAuth" version="~> 0.94.0" bitcodeEnabled="true" minTargetSdk="7.0" />
    </iosPods>
    </dependencies>
     
  6. TonismoGames

    TonismoGames

    Joined:
    Jun 12, 2018
    Posts:
    111
    Have you found a solution to this ?
     
  7. hippogames

    hippogames

    Joined:
    Feb 5, 2015
    Posts:
    233
    ROBYER1 and damelin like this.
  8. dustinkerstein

    dustinkerstein

    Joined:
    Jan 26, 2017
    Posts:
    16
    That workaround does indeed work, but do you think this something that should be addressed by Unity, or the plugin developer? Thanks!
     
  9. shefyg

    shefyg

    Joined:
    Oct 29, 2014
    Posts:
    4
    He had an important comment - put it on: defaultConfig