Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Error on bob aar build #79

Closed
LerDelijan opened this issue Aug 18, 2020 · 7 comments · Fixed by #175
Closed

Error on bob aar build #79

LerDelijan opened this issue Aug 18, 2020 · 7 comments · Fixed by #175
Assignees
Labels
bug Something isn't working

Comments

@LerDelijan
Copy link

Question

Hello,
My goal is to build an aar using bob. After I've executed create script:
npx @react-native-community/bob create react-native-awesome-module
I have added aar to targets in package.json:

"@react-native-community/bob": {
    "source": "src",
    "output": "lib",
    "targets": [
      ["aar", { "reverseJetify": true }],
      "commonjs",
      "module",
      "typescript"
    ]
  }

The error I get is as follows:

D:\react-native-awesome-module>bob build
ℹ Building target aar
ℹ Cleaning up previous build at lib\aar
ℹ Assembling Android project in android with gradle
bob.js build

build files for publishing

Options:
  --help     Show help                                                 [boolean]
  --version  Show version number                                       [boolean]

Error: The gradlew script doesn't seem to present in android. Make sure you have added it by running gradle wrapper in that directory.
    at androidAssemble (D:\react-native-awesome-module\node_modules\@react-native-community\bob\lib\utils\androidAssemble.js:35:11)
    at async build (D:\react-native-awesome-module\node_modules\@react-native-community\bob\lib\targets\aar.js:44:3)
    at async Object.handler (D:\react-native-awesome-module\node_modules\@react-native-community\bob\lib\cli.js:320:9)

Both gradlew and gradlew.bat files do present in android directory.
image

Should I add some extra configuration to build an aar or I have missed something in docs?

Thanks in advance!

@krizzu
Copy link
Collaborator

krizzu commented Sep 30, 2020

cc @matt-oakes any ideas?

@stacygrace
Copy link
Contributor

I think this is the issue here. On windows, gradleWrapper gets resolved to ./gradlew./gradlew.bat which doesn't work. I changed that line to the following and it ran without problems:

  const gradleWrapper = ((0, _os.platform)() === 'win32' ? 'gradlew.bat' : './gradlew');

@BartoszKlonowski
Copy link
Member

@chadmorrow Thank you for finding the solution!
Perhaps you would like to make a PR solving this issue with the fix you found?

@BartoszKlonowski BartoszKlonowski added the bug Something isn't working label May 31, 2021
@stacygrace
Copy link
Contributor

Sure! I can work on that later today

@BartoszKlonowski
Copy link
Member

@chadmorrow Thank you! I assigned you to this item just in case. Take your time and thank you for contributing!

@AsteriskZuo
Copy link

AsteriskZuo commented Apr 17, 2022

I ran into the same problem. I'll try it your way. @chadmorrow

@himanshurtanikatech
Copy link

himanshurtanikatech commented Jul 4, 2023

@chadmorrow how to implement const gradleWrapper = ((0, _os.platform)() === 'win32' ? 'gradlew.bat' : './gradlew');
this
file or other reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants