React-native-navigation: Unable to resolve dependency for '...': Could not resolve project :react-native-navigation

Created on 17 Jan 2019  路  10Comments  路  Source: wix/react-native-navigation

Issue Description

After carefully following the instructions in https://wix.github.io/react-native-navigation/#/docs/Installing, I am getting these errors after completing step 4 for Android:

ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve project :react-native-navigation.
Show Details
Affected Modules: app

ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve project :react-native-navigation.
Show Details
Affected Modules: app

ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve project :react-native-navigation.
Show Details
Affected Modules: app

WARNING: API 'variant.getMergeAssets()' is obsolete and has been replaced with 'variant.getMergeAssetsProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variant.getMergeAssets(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.
Affected Modules: app

What I've tried

  • Invalidate Cache/Restart
  • Update dependencies in build.gradle file

    dependencies {
      classpath 'com.android.tools.build:gradle:3.1.4'
      classpath 'com.google.gms:google-services:4.2.0'
    }
    
  • Disabled experimental feature for Gradle Only sync the active variant, which leads to two more errors:

    ERROR: Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve project :react-native-navigation.
    Show Details
    Affected Modules: app
    
    
    ERROR: Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve project :react-native-navigation.
    Show Details
    Affected Modules: app
    
  • Preferences > Appearance & Behavior > System Settings > HTTP Proxy > No Proxy

  • Moved google() to the top

    buildscript{
      ext {...}
      repositories {
        google()
        mavenLocal()
        ...
      }
      ...
    }
    allprojects {
      repositories {
        google()
        ...
      }
    }
    
  • Updated the gradle distributionUrl to 5.1.1-all and removed task wrapper

  • Remove .gradle, referenced here

    1. Invalidate caches / restart

    2. Shutdown Android Studio

    3. Remove .gradle folder

    4. Restart Android Studio

  • Set proxy both http and https in gradle.properties

    systemProp.http.proxyHost=127.0.0.1
    systemProp.https.proxyPort=12345
    org.gradle.jvmargs=-Xmx1234m
    systemProp.https.proxyHost=127.0.0.1
    systemProp.http.proxyPort=12345
    
  • Open an issue on wix/react-native-navigation

Steps to Reproduce

Step 1

Add the following

# android/settings.gradle

include ':react-native-navigation'
project(':react-native-navigation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation/lib/android/app/')

Step 2

Make sure you're using the new gradle plugin

# android/gradle/wrapper/gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip

Step 3

Update android/build.gradle

# android/build.gradle

buildscript {
    ext {
        buildToolsVersion = "27.0.3"
        minSdkVersion = 19
        compileSdkVersion = 27
        targetSdkVersion = 26
        supportLibVersion = "28.0.0"
    }
    repositories {
        google()
        mavenLocal()
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'
    }
}
allprojects {
    repositories {
        google()
        mavenCentral()
        mavenLocal()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        maven { url 'https://jitpack.io' }
    }
}

task wrapper(type: Wrapper) {
    gradleVersion = '4.4'
    distributionUrl = distributionUrl.replace("bin", "all")
}

Step 4

Update project dependencies

# android/app/build.gradle

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    defaultConfig {...}
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    ...
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation project(':react-native-navigation')
}

Sync project as necessary confirming that after step 4 the errors are produced

Environment

  • React Native Navigation version: 2.7.0
  • React Native version: 0.57.8
  • Platform(s) (iOS, Android, or both?): Android
  • Device info (Simulator/Device? OS version? Debug/Release?): Android Studio 3.3
  • Gradle 4.10.1
  • Android Gradle plugin 3.3.0
  • Android SDK Build Tools 28.0.3
  • macOS Mojave 10.14.2
  • Java 8 (brew cask)
questiostack overflow

Most helpful comment

I have same in RN 0.6.4 and RNN v3

All 10 comments

We use the issue tracker exclusively for bug reports and feature requests. This issue appears to be a general usage or support question. Instead, please ask a question on Stack Overflow with the react-native-navigation tag.

I'm having the same problem.....

@tiagoalexbastos try ignoring the error and proceed to set up as instructed in the docs. I was able to get rid of those errors at step 7, but after having completed all the steps, when I run npm run android, the app builds successfully but does not launch in the emulator. The emulator stays at the home screen.

I have also posted a question on stackoverflow about this

I'm having the same problem.....<

I have same in RN 0.6.4 and RNN v3

I have same in RN 0.6.4 and RNN v3

Did you ever get this fixed? I'm trying to upgrade from RN 59 to RN 0.60.2 right now and it is incredibly frustrating.

@inf3rnus I created a new RN project in 0.60.2 and copied the PodFile stucture then adding my own libs. That seemed to work.

@inf3rnus @mrquanghuy - Have you guys added missingDimensionStrategy "RNN.reactNativeVersion", "reactNative60" to the defaultConfig in app/build.gradle?

missingDimensionStrategy

Yes @ciawalsh, but the same problem here.

@inf3rnus @mrquanghuy - Have you guys added missingDimensionStrategy "RNN.reactNativeVersion", "reactNative60" to the defaultConfig in app/build.gradle?

Confirm it works by adding missingDimensionStrategy, my react native version 0.61.5

Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dozoisch picture dozoisch  路  35Comments

perrosnk picture perrosnk  路  36Comments

dozoisch picture dozoisch  路  37Comments

harveyconnor picture harveyconnor  路  57Comments

yusufyildirim picture yusufyildirim  路  53Comments