React-native-apple-authentication: Compile error: SignInWebViewDialogFragment

Created on 22 Sep 2020  路  10Comments  路  Source: invertase/react-native-apple-authentication

Running v2.0.1 and wasn't able to get this compiling.

> Task :invertase_react-native-apple-authentication:compileDebugKotlin FAILED

node_modules/@invertase/react-native-apple-authentication/android/src/main/java/com/RNAppleAuthentication/webview/SignInWebViewDialogFragment.kt: (53, 27): Type mismatch: inferred type is Context? but Context was expected

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':invertase_react-native-apple-authentication:compileDebugKotlin'.
> Compilation error. See log for more details
bug

Most helpful comment

Submitted a PR to address this. Appears to be a simple type issue brought on by a change in API30.

All 10 comments

@dburdan has this working I am certain, I haven't integrated it for Android as of yet but I'm surprised there is a compile failure. Are you certain you have kotlinVersion >= 1.3.50? (we specify 1.4.10)

Definitely running kotlin 1.4.10

buildscript {
    ext {
        androidXCore = "1.3.1"
        buildToolsVersion = "30.0.2"
        firebaseIidVersion = "20.2.4"
        googlePlayServicesAuthVersion = "18.1.0"
        kotlinVersion = "1.4.10"
        minSdkVersion = 26
        ndkVersion = "21.3.6528147"
        compileSdkVersion = 30
        targetSdkVersion = 30
    }

I just confirmed I am using version 2.0.1 of this package. I'm not using the android feature but it is in there and compiling.
I just confirmed that the example application is updated and has a new run:android task
I just confirmed the example application successfully runs

So, I can't reproduce this :thinking: - we'll need to see a reproduction posted to github in order to figure it out but I suspect either something project-specific or a very subtle interaction...

I'll take a look through the example app and see if there's anything i've missed.

Setting compileSdkVersion = 30 brings about the issue. Dropping that back to 29 allows everything to build as normal.

Good find! That explains why I haven't seen it yet.

From a react-native ecosystem perspective we appear to be on 29 still: https://github.com/facebook/react-native/blob/83777cb4fb5dda89c430b7eff9cd1f28d2577831/template/android/build.gradle#L7 so all my auto-demo scripts inherit it

I am still on 29 on my work project

No idea what could cause the API30 issue but it sounds like it's probably a real issue in the type inference on that method.

Have you tried simply reaching into that .kt file in node_modules and altering it to the indicated Context? vs current?

I'm on 29 as well. I will have time later today to test and dig into this.

@mikehardy not yet no. If @dburdan has time today then perhaps he can solve it. I won't be able to look into this further till later in the week.

Submitted a PR to address this. Appears to be a simple type issue brought on by a change in API30.

releasing 2.0.2 now that fixes this - thank you @dburdan - and @codecog for the report and then root cause discovery, a huge help

Was this page helpful?
0 / 5 - 0 ratings