Hello,
I'm following the steps on android but in android studio the build fails with the message. Gradle 4.1( I don't know if this is related)
Could not resolve project :react-native-navigation.
Required by:
project :app
Unable to find a matching configuration of project :react-native-navigation: None of the consumable configurations have attributes.
Error:Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve project :react-native-navigation.
Open File
Show DetailsError:Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve project :react-native-navigation.
Open File
Show DetailsError:Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve project :react-native-navigation.
Open File
Show DetailsError:Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve project :react-native-navigation.
Open File
Show DetailsError:Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve project :react-native-navigation.
Open File
Show Details
I leave the details below(my user is called home, is not a typo):
local.properties file
sdk.dir=/home/home/Android/Sdk
settings.gradle
include ':app'
include ':react-native-navigation'
project(':react-native-navigation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation/android/app/')
App gradle file
```
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
defaultConfig {
applicationId "com.example.home.myapplication"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "com.android.support:appcompat-v7:25.0.1"
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
//tried implementation as well here instead of compile but didn't work either
compile project(':react-native-navigation')
}
How did you fix it @guyca
??? any solution yet
I'm also having the same problem and could use some help.
How did you fix it ? @guyca @juanlet
I need to know how fix this problem ASAP!
Solve that by following :
https://wix.github.io/react-native-navigation/v2/#/docs/Installing?id=_8-rnn-and-react-native-version
Target the React Native version required by your project by specifying the RNN build flavor in android/app/build.gradle
android {
...
defaultConfig {
applicationId "com.yourproject"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
RNN only support react-native 0.51 ("reactNative51"), 0.55 ("reactNative55"), and 0.56 ("reactNative56")
Any updates here?
The same problem, please help
Okay, I finally found what causes the errors after 2 hours searching.
This line in settings.gradle is not correct:
project(':react-native-navigation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation/android/app/')
It should be: (Note there is a lib folder)
project(':react-native-navigation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation/lib/android/app/')
I think most of us have this problem because react-native link put this line in for us incorrectly.
You sir are amazing @minhloi
I'm also having the same problem and could use some help.
I try and test your answer and doesn't solve!
any update here?
I already have lib in my path still I am getting this error
rootProject.name = 'RNNavProj'
include ':react-native-navigation'
project(':react-native-navigation').projectDir = new File(rootProject.projectDir,
'../node_modules/react-native-navigation/lib/android/app/')
include ':app'
OS: Windows 10
react-native: 0.57.8
react-native-navigation": "^2.10.0"
In the file android/app/build.gradle
android {
defaultConfig {
applicationId "com.yourproject"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
_missingDimensionStrategy "RNN.reactNativeVersion", "reactNative57"_
versionCode 1
versionName "1.0"
}
}
Write value according on RN version:
reactNative55 - RN 0.55.x
reactNative56 - RN 0.56.x
reactNative57 - RN 0.57.0 - 0.57.4
reactNative57_5 - RN 0.57.5 and above
the path is error, are you sure the path can find the project?
Any Updates?
same for me
I found a solution that worked for me, hope it does for others too.
Firstly follow @enavermate's comment above to set correct RN version, then:
One of two things will happen, either the app will compile or new errors will appear 😂 , but this particular one will be resolved.
I have followed the instruction but problem is same. Please help.
@keshav00001 Same here :(
It just your internet is slow & not downloading related files. So please do sync gradle when high speed .
"react": "16.11.0",
"react-native": "0.62.2",
"react-native-notifications": "^3.2.2"
In settings.gradle...
project(':reactnativenotifications').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-notifications/lib/android/app')
you should just clean your project
Most helpful comment
Okay, I finally found what causes the errors after 2 hours searching.
This line in settings.gradle is not correct:
project(':react-native-navigation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation/android/app/')
It should be: (Note there is a lib folder)
project(':react-native-navigation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation/lib/android/app/')
I think most of us have this problem because react-native link put this line in for us incorrectly.