Estimote / react-native-proximity

React Native wrapper for Estimote Proximity SDK
Apache License 2.0
61 stars 38 forks source link

Project with path ':@estimote/react-native-proximity' could not be found in project ':app'. #18

Closed RajaSaravanan closed 6 years ago

RajaSaravanan commented 6 years ago
RajaSaravanan commented 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.

android/settings.gradle

_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!

RajaSaravanan commented 6 years ago

Do check the following after linking your 'react-native link @estimote/react-native-proximity'

  1. 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')

  2. android/app/build.gradle dependencies { ... compile project(':@estimote/react-native-proximity')
    }

heypiotr commented 6 years ago

Interesting. What's the output from react-native --version? (i.e., what version of RN and RN CLI are you running)

milesmatthias commented 6 years ago

Try removing the @ from those two files you mentioned in all places except the file system directory name.

michaelcuneo commented 6 years ago

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'.)

:(

heypiotr commented 6 years ago

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.

michaelcuneo commented 6 years ago
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.

michaelcuneo commented 6 years ago

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.

timsatterfield commented 6 years ago

+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

timsatterfield commented 6 years ago

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')
heypiotr commented 6 years ago

I dug a little deeper into this.

First of all, the underscores in:

… 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.