Google-signin: RN 0.61.2. Project with path ':react-native-google-signin' could not be found in project ':app'

Created on 15 Oct 2019  路  10Comments  路  Source: react-native-google-signin/google-signin

Steps to Reproduce

Follow installation instructions for RN > 0.60 then build (react-native run-android)

Expected Behavior

No errors.

Actual Behavior

FAILURE: Build failed with an exception.

  • Where:
    Build file '/home/opc/serban/rn60app/appname/android/app/build.gradle' line: 193

  • What went wrong:
    A problem occurred evaluating project ':app'.

    Project with path ':react-native-google-signin' could not be found in project ':app'.

Environment

RN 0.61.2
"@react-native-community/google-signin": "^3.0.1"
Gradle 5.5
play-services-auth 16.0.1

Most helpful comment

try
in settings.gradle:
rootProject.name = 'YourProjectName'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':react-native-google-signin'
project(':react-native-google-signin').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/google-signin/android')

include ':app'

All 10 comments

try
in settings.gradle:
rootProject.name = 'YourProjectName'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':react-native-google-signin'
project(':react-native-google-signin').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/google-signin/android')

include ':app'

After adding the code above I'm getting another error (see below).

P.S I'm also using react-native-firebase. Maybe a collision of dependencies!?

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
    > com.android.build.api.transform.TransformException: Error while generating the main dex list:
    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

os sometimes :

Program type already present: co.apptailor.googlesignin.BuildConfig

LATER EDIT:

Yep, it seems to be a collision of dependencies with react-native-firebase. The build was successful without react-native-firebase.

But cannot find the right build configuration to avoid this. Any ideas?

LATER EDIT:

It seems to have something to do with "multidex true" required by react-native-firebase firestore module.

I had the same problem. I followed @Ghcml advice (above).

  1. I deleted the following line from the file \android\appbuild.gradle
    implementation(project(":react-native-google-signin"))

  2. I added the following 2 lines to the file \android\settings.gradle

include ':react-native-google-signin'
project(':react-native-google-signin').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/google-signin/android')

@Bilal-Abdeen the two lines in android\settings.gradle do not need to be there, either.

@vonovak You are right. Thank you. Only deleting the following line from the file (\android\appbuild.gradle) seems to fix the problem.
implementation(project(":react-native-google-signin"))

@vonovak ,

I have commented all occurrences of 'react-native-google-signin' from both the files app\build.gradle and android\settings.gradle

I am using the following configs in android\app\build.gradle

def enableSeparateBuildPerCPUArchitecture = true
def enableProguardInReleaseBuilds = true

Enabling these gets me the following errors everytime ->

In Android Studio

ERROR: The modules ['@react-native-community-google-signin-android-@react-native-community_google-signin', '@react-native-community-google-signin-android-react-native-google-signin'] point to the same directory in the file system.
Each module must have a unique path.

In React Native Console

Task :app:transformClassesAndResourcesWithR8ForRelease FAILED
R8: Program type already present: co.apptailor.googlesignin.PendingAuthRecovery

@saileshsahu that seems like a different issue. Please open a new one and add a runnable repro, thanks

try
in settings.gradle:
rootProject.name = 'YourProjectName'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':react-native-google-signin'
project(':react-native-google-signin').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/google-signin/android')

include ':app'

but producing the following error
ERROR: The modules ['@react-native-community_google-signin', 'react-native-google-signin'] point to the same directory in the file system.
Each module must have a unique path.

i'm confused
why is it

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:23.0.1"
    implementation "com.facebook.react:react-native:+"
    implementation(project(":react-native-google-signin"))
}

when project is @react-native-community/google-signin since v3 ?

works fine ( implementation(project(":react-native-community_google-signin")) )

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'com.android.support:multidex:1.0.3' // use latest version
    implementation "com.android.support:appcompat-v7:28.0.0"
    //noinspection GradleDynamicVersion
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation(project(":react-native-community_google-signin"))

@vonovak You are right. Thank you. Only deleting the following line from the file (\android\appbuild.gradle) seems to fix the problem.
implementation(project(":react-native-google-signin"))

Indeed, deleting this line seemed to fix the issue in my case.

Was this page helpful?
0 / 5 - 0 ratings