Skip to content

run-android fails in custom project structure #956

Closed

Description

@BharathMG-ShareChat

My project structure looks like this,

- appName
   -- reactNative // React native package.json, node_modules,...
   -- app // Android app folder

If I run, "npx react-native run-droid" inside reactNative folder, it fails with,

error Android project not found. Are you sure this is a React Native project?

This is because, cli checks for android/gradlew inside root folder which is not there in my project structure. It is in appName/gradlew. How can I change this gradlew path in cli command?

Activity

  1. added
    question
    on Feb 12, 2020
  2. thymikee commented on Feb 12, 2020

    @thymikee
    Member

    You can either create a react-native.config.js file in the project root, or run the command from the project root, or both.

  3. BharathMG-ShareChat commented on Feb 12, 2020

    @BharathMG-ShareChat
    Author

    @thymikee I thought run-android doesn't use config yet. I saw your PR #791 fixes this issue. Not sure if I'm missing something. Could you point me to a sample react-native.config.js file for custom project structure? Thanks!

  4. thymikee commented on Feb 12, 2020

    @thymikee
    Member

    Having react-native.config.js in a directory is a trick to tell the CLI that "here's the root of the project, let's look up from there".

    Sample config:

    module.exports = {};
  5. grabbou commented on Feb 17, 2020

    @grabbou
    Member

    Aside from that, yeah, this is a duplicate of #791 that @thymikee was/is working on. I am working on cleaning up the next branch and we will resume work no that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    question

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions