Closed RajaSaravanan closed 6 years ago
After spending almost 4+ hrs of different approach, finally found that the 'react-native link @estimote/react-native-proximity' is linking the library as below.
_include ':@estimote_react-native-proximity'_ _project(':@estimote_react-native-proximity').projectDir = new File(rootProject.projectDir, '../nodemodules/@estimote/react-native-proximity/android')
Checkout that @estimotereact, actually the path is '@estimote/' not underscore ''. That's why the project path not found error has been thrown.
I'm from an iOS developer background, maybe for android developers it will be easy to identify the root cause. But for me almost half of my working day gone :(
Will be helpful to some guys!
Do check the following after linking your 'react-native link @estimote/react-native-proximity'
android/settings.gradle include ':@estimote/react-native-proximity' project(':@estimote/react-native-proximity').projectDir = new File(rootProject.projectDir, '../node_modules/@estimote/react-native-proximity/android')
android/app/build.gradle
dependencies {
...
compile project(':@estimote/react-native-proximity')
}
Interesting. What's the output from react-native --version
? (i.e., what version of RN and RN CLI are you running)
Try removing the @
from those two files you mentioned in all places except the file system directory name.
I'm having the same problem. Although, mine appears to be linked correctly.
settings.gradle contains
rootProject.name = 'FestivalXNative'
include ':@estimote/react-native-proximity'
project(':@estimote/react-native-proximity').projectDir = new File(rootProject.projectDir, '../node_modules/@estimote/react-native-proximity/android')
include ':app'
Dependencies shows.
dependencies {
compile project(':@estimote/react-native-proximity')
...
}
Unable to find module with Gradle path ':@estimote/react-native-proximity' (needed by module 'app'.)
:(
What's the output from react-native --version
? (i.e., what version of RN and RN CLI are you running) I'll try to reproduce it with these versions.
react-native-cli: 2.0.1
react-native: 0.55.4
I've tried with both react-native init [projectname] & create-react-native-app [projectname] | npm run eject.
I managed to get it working fine with a few minor changes running react-native init [project name]... still doesn't work with create-react-native-app [project name] which is my preferred method. But, at least it works with one of them.
+1
react-native-proximity = Latest version android studio = 3.1.2 os: mac 10.13.4 react-native-cli: 2.0.1 react-native: 0.52.0 gradle: 4.4
Workaround
# app/build.gradle
...
dependencies {
compile project(':estimote_react-native-proximity')
...
# settings.gradle
include ':estimote_react-native-proximity'
project(':estimote_react-native-proximity').projectDir = new File(rootProject.projectDir, '../node_modules/@estimote/react-native-proximity/android')
I dug a little deeper into this.
First of all, the underscores in:
include ':@estimote_react-native-proximity'
project(':@estimote_react-native-proximity')
compile project(':estimote_react-native-proximity')
… are actually okay/correct. This is the name of the project/module that's being linked, and in fact, slashes in Gradle project names turn out to be deprecated. The path to the project/module is this part inside File(...)
:
project(':estimote_react-native-proximity').projectDir = new File(rootProject.projectDir, '../node_modules/@estimote/react-native-proximity/android')
… and that uses slashes as it should be.
It turns out that older version of React Native used to generate project names with slashes, and they changed that later to replace them with underscores.
If anyone's project still uses slashes, it's probably better to change them to underscores. Just make sure that you change this in both settings.gradle
, and build.gradle
, like the in the comment above by @timsatterfield.