Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Change the default folder location for android and ios #2005

Closed
smubarak-ali opened this issue Jul 7, 2023 · 6 comments
Closed

Change the default folder location for android and ios #2005

smubarak-ali opened this issue Jul 7, 2023 · 6 comments
Labels
question Further information is requested

Comments

@smubarak-ali
Copy link

Ask your Question

Hi there,
Can someone help me out as I am stuck with this problem since yesterday. I am trying to change the default folders for android and ios to a custom nested folder e.g. ./test/android and ./test/ios
In the previous version, I follow the issue #1103 and it was done but with the latest version, I am unable to do that.

Any help would be highly appreciated.

Thank you.

@smubarak-ali smubarak-ali added the question Further information is requested label Jul 7, 2023
@szymonrybczak
Copy link
Collaborator

Hey! 👋 What issue do you have if you're adding custom project source directories with react-native.config.js? Also please provide your React Native version.

@smubarak-ali
Copy link
Author

Hi @szymonrybczak,
Thank you very much for the response. I have attached a few screenshots and also copying the error logs below.

React Native v0.72.1

Screenshot 2023-07-07 at 3 33 55 PM

Screenshot 2023-07-07 at 3 32 33 PM

ERROR_LOG:
`
FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring project ':app'.

Failed to notify project evaluation listener.
/Users/sebireland/codes/seb-life-portal-app/SEBLifePortalApp/stage/node_modules/react-native/ReactAndroid/gradle.properties (No such file or directory)

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

BUILD FAILED in 4s
error Failed to install the app. Command failed with exit code 1: ./gradlew tasks FAILURE: Build failed with an exception. * What went wrong:
A problem occurred configuring project ':app'.

Failed to notify project evaluation listener. > /Users/sebireland/codes/seb-life-portal-app/SEBLifePortalApp/stage/node_modules/react-native/ReactAndroid/gradle.properties (No such file or directory) * Try:
Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 4s
Task :gradle-plugin:compileKotlin UP-TO-DATE
Task :gradle-plugin:compileJava NO-SOURCE
Task :gradle-plugin:pluginDescriptors UP-TO-DATE
Task :gradle-plugin:processResources UP-TO-DATE
Task :gradle-plugin:classes UP-TO-DATE
Task :gradle-plugin:jar UP-TO-DATE
Task :gradle-plugin:inspectClassesForKotlinIC UP-TO-DATE
5 actionable tasks: 5 up-to-date.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
SEBs-MacBook-Pro:SEBLifePortalApp sebireland$ yarn android --info
yarn run v1.22.19
$ react-native run-android --info
error: unknown option '--info'
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
`

@szymonrybczak
Copy link
Collaborator

Okay, so that's not the problem with React Native CLI. I see the problem in your setup, you passed to the react-native.config.js as sourceDir for android this path ./stage/android - and in your build.gradle I see that sometimes your referencing to ../../node_modules and sometimes to ../../../node_modules. To make it work you need to unify these paths - to make sure they're pointing to the correct node_modules path.

@smubarak-ali
Copy link
Author

I have double checked and looks fine to me.

./stage/android/settings.gradle: (two levels of nesting to the node_modules, so using the ../../)
rootProject.name = 'SEBLifePortalApp' apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) include ':app' includeBuild('../../node_modules/@react-native/gradle-plugin')

./stage/android/app/build.gradle: (three levels of nesting to the node_modules, so using the ../../../)
apply from: file("../../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

But somehow the settings are looking for wrong path:
/Users/sebireland/codes/seb-life-portal-app/SEBLifePortalApp/stage/node_modules/react-native/ReactAndroid/gradle.properties (No such file or directory)

The node_modules is not under the /stage instead it's still at the root of the project, so that's what bothering me. I can't seem to find where else I need to update the lookup for node_modules path

@szymonrybczak
Copy link
Collaborator

In build.gradle that is placed in stage/android/app/build.gradle you have properties like root, reactNativeDir and cliFile that are referencing ./../../ but should reference to ./../../../. If it still doesn't work for you please check this article, it is very handy :) There are listed all places where you should change path to correctly point node_modules.

@smubarak-ali
Copy link
Author

@szymonrybczak
Thank you so much for the help and article. It solved my issue.

Just added the hermesCommand and also the allproject scope.

Thanks a million buddy!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants