React Native with @react-native-community/google-signin : Program type already present: co.apptailor.googlesignin.PendingAuthRecovery

Viewed 693

The error appear on TypeScript project with React Native and Firebase:

    "@react-native-community/google-signin": "^4.0.3",
    "@react-native-firebase/app": "^8.2.0",
    "@react-native-firebase/auth": "^8.0.8",
    "@react-native-firebase/firestore": "^7.2.2",
    "@react-native-firebase/storage": "^7.1.6",
    "@react-navigation/native": "^5.6.0",
    "prop-types": "react-native-community/google-signin",
    "react": "16.11.0",
    "react-native": "0.62.2",
    ...

Before adding @react-native-community/google-signin the project build nicely on Android. Then I added it and followed the steps here: https://github.com/react-native-community/google-signin/blob/master/docs/android-guide.md

I cleaned the build with ./gradlew clean

Now when I run yarn android, I have:

D8: Program type already present: co.apptailor.googlesignin.PendingAuthRecovery

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:multiDexListDebug'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Error while merging dex archives:
     Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
     Program type already present: co.apptailor.googlesignin.PendingAuthRecovery

I checked the build.gradle files but did not find other auth related dependency I could have added. The project is relatively fresh.

In android/app/build.gradle I have:

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:23.0.1"
    //noinspection GradleDynamicVersion
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
    implementation 'com.android.support:multidex:1.0.3'
    debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
      exclude group:'com.facebook.fbjni'
    }
    debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
    }
    debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
    }
    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}

I made the check required here, with no success: https://github.com/react-native-community/google-signin/issues/763

1 Answers

This was due to this line in package.json:

"prop-types": "react-native-community/google-signin",

I removed prop-types:

yarn remove prop-types

Now things are working like a charm.

It was probably not the good way to add the types.

Related