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

fix: Use custom app name when getting build.gradle #2524

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

TMisiukiewicz
Copy link
Collaborator

@TMisiukiewicz TMisiukiewicz commented Oct 10, 2024

Summary:

It cannot access package name from build.gradle when the module is named differently than app. This PR is fixing it.

Closes #2516

Test Plan:

  1. Init fresh project
  2. Change android/app folder name to android/test
  3. Create react-native.config.js file with the following content:
module.exports = {
  project: {
    android: {
      appName: 'test',
    },
  },
};
  1. Run android command and verify the error about missing package name is not thrown

Checklist

  • Documentation is up to date to reflect these changes.
  • Follows commit message convention described in CONTRIBUTING.md

@cortinico
Copy link
Member

3. Create react-native.config.js file with the following content:

Is this documented somewhere or is it a new config?

@szymonrybczak
Copy link
Collaborator

Is this documented somewhere or is it a new config?

If you mean the property appName -- yes it was added a while ago and it's document here.

@cortinico
Copy link
Member

Is this documented somewhere or is it a new config?

If you mean the property appName -- yes it was added a while ago and it's document here.

yup that one 👍 thank you

@szymonrybczak
Copy link
Collaborator

Let's fix CI failures and it's good to go for me!

@szymonrybczak
Copy link
Collaborator

Ah, because of recent package refactors there are some merge conflicts 🥲 @TMisiukiewicz can you take a look? 🙏

@thymikee
Copy link
Member

@TMisiukiewicz let’s rebase this and we’re good to go :)

const buildGradlePath = findBuildGradle(
sourceDir,
false,
appName === '' ? 'app' : appName,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be just appName?

Suggested change
appName === '' ? 'app' : appName,
appName,

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

Successfully merging this pull request may close these issues.

config fails to load if Android module is named differently than app
4 participants